/**
* Copyright (C) 2014, CSU
* All rights reserved
* File Name:test.cpp
* Author: lmm
* Date of completion: 2015/1/12
* Version: v1.0
*
* 问题描述:字符串逆序
* 输入描述: 允许有空格输入,例如 输入“I am a student”
* 程序输出: 输出逆序字符串 例如 输出“tneduts a ma I”
*/
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
char str[100] = "";
gets(str);
int length = strlen(str);
for (int i = length - 1; i >= 0; --i)
{
cout << str[i] ;
}
return 0;
}
注意:char 与string的区别
字符串逆序
最新推荐文章于 2016-12-11 23:41:34 发布