| Topic: |
Religions > Bible |
| User: |
"Simon" |
| Date: |
28 Jan 2004 03:43:51 PM |
| Object: |
C++ grammar. |
#include <iostream>
using namespace std;
int main()
{
string input, output;
input = get_input();
while (input != "QUIT")) {
output = get_output(input);
display_output(output);
input = get_input();
}
}
string get_input()
{
string input;
cout << "Enter word of \"QUIT\" to quit:" << endl;
cin.getline(input);
return input;
}
string get_output(const string &input)
{
string output;
if (input == "your") {
output = "Belonging to, or of, you.";
} else if (input == "you're") {
output = "Short for \"you are\".";
} else {
output = "Invalid input.";
}
return output;
}
void display_ouput(const string &output)
{
cout << output;
}
// Any suggestions are welcome!
.
|
|

|
Related Articles |
|
|