📄 reverse.cpp
字号:
#if !defined( __STACK_H )
#include <Stack.h>
#endif // __STACK_H
#if !defined( __STRNG_H )
#include <Strng.h>
#endif // __STRNG_H
#ifndef __IOSTREAM_H
#include <iostream.h>
#endif
int main()
{
Stack theStack;
String reverse("reverse");
cout << "\nEnter some strings. Reverse will collect the strings\n";
cout << "for you until you enter the string \"reverse\". Reverse\n";
cout << "will then print out the strings you have entered, but in\n";
cout << "reverse order. Begin entering strings now.\n";
for(;;)
{
char inputString[255];
cin >> inputString;
String& newString = *( new String( inputString ) );
if( newString != reverse )
{
theStack.push( newString );
}
else
{
break;
}
}
cout << "\nThe strings you entered (if any) are:\n";
while( !(theStack.isEmpty()) )
{
Object& oldString = theStack.pop();
cout << oldString << "\n";
delete &oldString;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -