why is there a parse error when I add
else if(cat==2)
and even if I type 1 or 2 in my proggie, it comes up with a messed up version,
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;
family.age=11;
family.name = "Katherine";
family.name2 = "Lau";
database friends;
friends.age=14;
friends.name = "Richard";
friends.name2 = "Reader";
cout<<"Please input 2,family or 1,friends";
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;
}