Ok, i tried learning structures but i keep getting this error:
syntax error before '.' token
this is my code:
anyone know what the problem is?Code:#include <iostream>
using namespace std;
struct company {
char name[50];
int sales;
int price;
char owner[50];
};
int main()
{
cout<<"Enter the company name: \n";
cin>>company.name; //get error here
cin.ignore();
cout<<"How many sales did it make? \n";
cin>>company.sales; //and here
cin.ignore();
cout<<"How much did they sell it for? \n";
cin>>company.price; //not to mention here
cin.ignore();
cout<<"Who is the company owner? \n";
cin>>company.owner; //oh yea, and here too...
cin.ignore();
cout<<"Company: " << company.name << endl; //and here
cout<<"Sales: " << company.sales << endl; //and here
cout<<"Price: " << company.price << endl; //and here
cout<<"Owner: " << company.owner << endl; //and here
}