topical media & game development
basic-program-solutions-05-Soln5-4.c
? /
basic-program-solutions-05-Soln5-4.c
// Soln5_4.cpp
include <iostream>
using std::cin;
using std::cout;
using std::endl;
// Read a number and a name
void GetData(int& number, char name[])
{
cout << "Enter a number: ";
cin >> number;
if (number != 0)
{
cout << endl << "And a name: ";
cin >> name;
}
}
void PutData(int number, char name[])
{
cout << endl << "Thank you. Your number and name were "
<< number << " and \"" << name << "\"" << endl;
}
int main()
{
int number;
char name[15];
for (;;)
{
GetData(number, name);
if (number == 0)
break;
PutData(number, name);
}
return 0;
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.