topical media & game development
basic-program-solutions-07-Soln7-9.c
? /
basic-program-solutions-07-Soln7-9.c
// Soln7_9.cpp : main project file.
include <stdafx.h>
using namespace System;
ref class Record
{
public:
int getRecord()
{
Console::Write(L"Enter a number: ");
number = Int32::Parse(Console::ReadLine());
if (number != 0)
{
Console::Write(L"And a name: ");
name = Console::ReadLine();
}
return number;
}
void putRecord()
{
Console::WriteLine(L"The number and name are {0} and \"{1}\"",
number, name);
}
private:
int number;
String^ name;
};
int main(array<System::String ^> ^args)
{
while (true)
{
Record^ record = gcnew Record;
if(record->getRecord() == 0)
break;
record->putRecord();
}
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.