全WAAAAA 求助大佬

P5705 【深基2.例7】数字反转

界内嘻哈 @ 2020-05-11 17:28:49

我把gets( )换成了getline( )
咋还不对啊
#include<bits/stdc++.h>
using namespace std;

int main(void)
{
    string str;
    int i;
    getline(cin,str);
    for(i=str.length()-1; i >= 0; i--)
    {
        printf("%c", str[i]);
    }   
    return 0;
}

by Surelysuper @ 2020-05-11 17:32:19

@界内嘻哈 说了用cin啊


by 界内嘻哈 @ 2020-05-11 17:33:47

cin咋用啊@蒟蒻跟风侠


by 界内嘻哈 @ 2020-05-11 17:33:59

啊哈哈哈


by Malixin1234 @ 2020-05-11 17:38:14

直接这样就可以了。

cin>>str;

by Malixin1234 @ 2020-05-11 17:38:32

@界内嘻哈


by 界内嘻哈 @ 2020-05-11 17:40:42

@马先生 不行啊,Vs执行没反映


by liqingyang @ 2020-05-11 17:41:35

@界内嘻哈

#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    string str;
    cin>>str;
    reverse(str.begin(),str.end());
    cout<<str<<endl;
    return 0; 
}

by Surelysuper @ 2020-05-11 17:42:40

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    int i;
    cin>>str;
    for(i=str.length()-1; i >= 0; i--)
        printf("%c", str[i]); 
    return 0;
}

by Surelysuper @ 2020-05-11 17:42:44

@界内嘻哈


by Surelysuper @ 2020-05-11 17:43:07

@liqingyang %%%


| 下一页