Dec 9, 2012 at 1:53pm UTC
what is wrong with the code?
#include <iostream.h>
struct Employee
{
int empno;
char name;
char dept;
int salary;
char category;
}emp;
void main()
{
cout<<"enter employee no";
cin>>emp.empno;
cout<<"enter employee name";
cin>>emp.name;
cout<<"enter the dept:";
cin>>emp.dept;
cout<<"enter salary";
cin>>emp.salary;
if(emp.salary>>4000)
emp.category='A';
else
emp.category='B';
cout<<"the employee is" ;
cout<< emp.name;
cout<<emp.dept;
cout<<emp.salary;
cout<<emp.category;
}
Dec 9, 2012 at 2:04pm UTC
if (emp.salary>> /*'>'?*/ 4000)
Dec 9, 2012 at 2:09pm UTC
it says declaration syntax error
#include <iostream.h>
struct Employee
{
int empno;
char name;
char dept;
int salary;
char category;
}emp;
void main()
{
cout<<"enter employee no";
cin>>emp.empno;
cout<<"enter employee name";
cin>>emp.name;
cout<<"enter the dept:";
cin>>emp.dept;
cout<<"enter salary";
cin>>emp.salary;
if(emp.salary>4000)
emp.category='A';
else
emp.category='B';
cout<<"the employee is" ;
cout<< emp.name;
cout<<emp.dept;
cout<<emp.salary;
cout<<emp.category;
}
Dec 9, 2012 at 2:21pm UTC
#include <iostream.h >
and btw, use code tag will ya... :D
Dec 9, 2012 at 4:32pm UTC
soory shows un expected results
Dec 9, 2012 at 7:54pm UTC
tHANX A LOT GUATEMALA007 WHATS THE USEE OF
CIN.GETLINE??
Last edited on Dec 9, 2012 at 7:57pm UTC
Dec 9, 2012 at 8:18pm UTC
Oh sorry didn't realize i used it, but its just so if you input spaces or blank characters into the response the computer actually includes them in the output. Normally if you entered a name followed by a space then a last name everything after the space would be ignored, but with cin.getline(); the whole input is incorporated into the char array.
Dec 9, 2012 at 8:20pm UTC
any ways thanx @guatemala007