
Untitled
By: a guest on Jan 28th, 2012 | syntax:
None | size: 1.01 KB | hits: 7 | expires: Never
id=rand()%9000+1000;
pet.setId(id);
cout<<"Enter the type of pet"<<endl;
cin>>type;
pet.setType(type);
cout<<"Enter the color of the pet"<<endl;
cin>>color;
pet.setColor(color);
cout<<"Enter the 'f' if the pet is a female, or 'm' if the pet is a male"<<endl;
cin>>gender;
pet.setGender(gender);
cout<<"Enter the date this pet was acquired"<<endl;
cin>>day;
dac.setDay(day);
cin>>month;
dac.setMonth(month);
cin>>year;
dac.setYear(year);
cout<<"Enter the cost of the pet"<<endl;
cin>>cost;
pet.setCost(cost);
cout<<endl<<"Your Pet's ID number is: "<<id<<endl<<endl;
ofstream PetFile;
PetFile.open("PetFile.txt", ios_base::out);
if (PetFile.is_open())
{
PetFile << "ID: " <<id<<"\n"<< "Type: "<<type<<"\n"<<"Color:" <<color<<"\n"<< "Gender: "<<gender<< "\n" <<"Date Acquired: "<<day<<"/"<<month<<"/"<<year<<endl;
PetFile.close();
}
else
{
cout<<endl<<"Operation unsuccessful"<<endl;
}
cout<<"Record Added!"<<endl;
displayMenu();