#include<iostream>
#include<windows.h>
#include<string.h>
using namespace std;
int reversalstr(char *p)
{
int count = strlen(p);
char temp;
cout << count;
for (int i = 0; i < count / 2; i++)
{
temp = p[i];
p[i] = p[count - i-1];
p[count - i-1] = temp;
}
//p[0] = p[2];
return 0;
}
int main()
cin >> pstr;
cout << "\n" << "字符串:" << pstr<< endl;
reversalstr(pstr);
cout << "\n" << "字符串:" << pstr<< endl;
system("pause");
}
#include<windows.h>
#include<string.h>
using namespace std;
int reversalstr(char *p)
{
int count = strlen(p);
char temp;
cout << count;
for (int i = 0; i < count / 2; i++)
{
temp = p[i];
p[i] = p[count - i-1];
p[count - i-1] = temp;
}
//p[0] = p[2];
return 0;
}
int main()
{
char pstr[30];
cout << "请键入字符串:"<<endl;cin >> pstr;
cout << "\n" << "字符串:" << pstr<< endl;
reversalstr(pstr);
cout << "\n" << "字符串:" << pstr<< endl;
system("pause");
}