#include<iostream>
#include<conio>
#include<string>
using namespace std;
class CompanyName
{
public:
char name[10];
void display()
{
if(name=="emily")
cout<<"Hired!"<<endl;
}
};
void main()
{
CompanyName c;
cout<<"enter name"<<endl;
cin>>c.name;
c.display();
getch();
}
So my friend just got placed in a company and I want to congratulate her (and announce that so-and-so company hired her) on her facebook wall, using a small CPP programme. I don't want to just print 'congratulations Emily!' because I already did that for something else. So this time you can see what I want to do if you just look at the code. Any better suggestions are highly welcome. But my problem here is, I can't get this code to run. I feel like the 'if' line is not right. Can someone please correct the code for me? I'm still a beginner.
Aucun commentaire:
Enregistrer un commentaire