求助!

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

·Ansel @ 2020-01-25 19:29:52

#include <iostream>
#include <cstring>
using namespace std;
string str;
int len;
int main()
{

    cin >> str;
    len = str.length();
    for (int i = len; i >= 0; i--)
    {
        cout << str[i];
    }

}

by andyli @ 2020-01-25 19:31:05

i=len-1


by 闪电皮卡丘 @ 2020-01-25 19:33:53

@·Ansel retrun 0;写上吧


by Tino2023 @ 2020-02-12 11:14:39

很简单的一道题

#include<iostream>
#include<string.h>
using namespace std;
int main(){
    char n[100];
    cin >> n;
    int len=strlen(n);

    for(int i=len-1;i>=0;i--){
        cout << n[i];
    }
    return 0;
}

|