Can someone explain what is wrong with my code?
Code://explation: Writing a database to hold friends and family, just as a test of //my programming skills. It should ask you to select a catagory in the beginning //then you will go to the relavent section. The problem is, it has alot of syntax //errors, there are still errors and most sections which cause the errors have been //commented out. Please help me fix the code. #include <iostream> #include <string> using std::string; using std::cout; using std::endl; struct database { int age; string name; string name2; }; int main() { database family; //will be known as catagory 2 family.age=11; family.name = "Katherine"; family.name2 = "Lau"; } database friends; //catagory 1 friends.age=14; friends.name = "Richard"; friends.name2 = "Reader"; cout<<"Select Catagory(1 or 2)"; //int cat; //cin<<cat; //IF(cat==1) { cout << "First Name :" << friends.name << endl; cout << "Surname :" << friends.name2 << endl; cout << "Age :" << friends.age << endl; } //else if(cat==2) { //cout << "First Name :" << family.name << endl; //cout << "Surname :" << family.name2 << endl; //cout << "Age :" << family.age << endl; } return 0; {



LinkBack URL
About LinkBacks


