Ifsting problem

I need help about database, my problem is I need a code on how can I pop out my output on Microsft Excel after I run in on c++

my prof told me to use this example
#include<iostream.h>
#include<fstream.h>

main()
{
char name[50]
ifstream mydata("emp.xlsx")

mydata>>name
cout<<name
}
so basically ifstream is my problem here and I don't know how to use it


here is my code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream.h>
#include<fstream.h>

ofstream mydata("emp.xlsx",ios::app);

main()
{
char name[100],address[100],a,b;
int code,number;

cout<<"Lets save your data";
cout<<"Y or N";
cin>>a;

if(a=='y')
{
cout<<"SNC PROJECT SYSTEM";
cout<<"Enter your EMployee Number";
cin>>number;
cout<<"Employee Code";
cin>>code;
cout<<"Employee Address";
cin>>address;
cout<<"Employee Status";
cin>>b;

if(b=='r')
{
cout<<"Regular";
}
else if(b=='c')
{
cout<<"Contractual";
}
else
{
cout<<"invaluid";
}

mydata<<number;
mydata<<code;
mydata<<address;
mydata<<b;
}
else if(a=='n')
{
cout<<"thank you";
}
else
{
cout<<"invalid";
}

}
Last edited on
Topic archived. No new replies allowed.