📄 pex10_4.cpp
字号:
#include <iostream.h>
#pragma hdrstop
#include "wex10_9.h"
#include "strclass.h"
void main(void)
{
// all palindromes we find are stored in s
String s[50], current;
// number of palindromes we find
int numStrings = 0;
// read whitespace separated words until end of file
while(cin >> current)
// if a word is a palindrome, insert it into s and
// increment the count numStrings
if (pal(current,0,current.Length()-1))
s[numStrings++] = current;
// print the palindromes we found
cout << "The palindromes are: " << endl << endl;
for(int i=0;i < numStrings;i++)
cout << s[i] << endl;
}
/*
<Run>
dad
horse
level
arithmetic
madamimadam
computers
amanaplanacanalpanama
The palindromes are:
dad
level
madamimadam
amanaplanacanalpanama
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -