1097:字符串问题

xiaoxiao2021-02-28  62

1097:字符串问题

Description

字符串处理在计算机中有很多复杂的操作,但是这些复杂的操作都是由基本的字符串操作复合而成,要求编写一字符串颠倒的程序,把字符串中的字符颠倒位置。

Input

输入一字符串(<255)。

Output

按位进行颠倒的结果。

Sample Input

COMPUTER

Sample OUtput

RETUPMOC

#include<iostream> #include<stdio.h> #include<string.h> using namespace std; int main() { char a[100]; int n; gets(a); n=strlen(a); int i; for(i=n-1;i>=0;i--) { printf("%c",a[i]); } return 0; }

转载请注明原文地址: https://www.6miu.com/read-35916.html

最新回复(0)