cpython3


私信TA

用户名:smartZhou

访问量:71797

签 名:

等  级
排  名 36
经  验 12951
参赛次数 1
文章发表 99
年  龄 0
在职情况 学生
学  校
专  业 计算机科学与技术

  自我简介:

注意事项:

getline(cin,str)输入一行

直接cin>>str只能接收空格之前的字符串。

参考代码:

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() 
{
	string str;        //Declare a string 
	getline(cin,str);  //Input a line
	reverse(str.begin(),str.end()); //make the string reverse
	cout<<str;                      //Output
	return 0;
}


 

0.0分

44 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    char c[100];
    gets(c);
    int l=strlen(c);
    for(int i=l;i>=0;i--)
    printf("%c",c[i]);
    return 0;
}  

大佬们看看我这个咋错了
2023-04-09 15:56:40
STL库,先赞一个
2022-02-21 19:23:05
  • «
  • 1
  • »