第一个C++程序如下:
#include
#include
using namespace std;
void main()
{
string str;
printf("Input a line:");
cin>>str;
for(string::iterator iter = str.begin(); iter != str.end(); ++iter)
{
if( ((*iter >= 'a' ) && (*iter <= 'z')) ||((*iter >= 'A')&&(*iter <= 'Z')))
{
*iter += 5;
if(((*iter>'z')&&(*iter<='z'+5))|| ((*iter>'Z')&&(*iter<='Z'+5)))
{
*iter -= 26;
}
}
}
cout<
修改了一下,O了!