-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPQ13.cpp
More file actions
53 lines (40 loc) · 1.09 KB
/
PQ13.cpp
File metadata and controls
53 lines (40 loc) · 1.09 KB
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
#include <bits/stdc++.h>
using namespace std;
class StudentInfo
{
public:
int St_RollNumber;
string St_Name;
int St_Class;
int St_Year;
int St_Marks;
};
int main()
{
ofstream f2;
f2.open("studentinfo.txt");
for (int i = 0; i < 5; i++)
{
StudentInfo object;
cout<<"Enter roll number:";
cin >> object.St_RollNumber;
f2 << object.St_RollNumber << " ";
cin.ignore();
cout<<"Enter student name:";
getline(cin, object.St_Name);
f2 << object.St_Name << " ";
cout<<"Enter student class:";
cin >> object.St_Class;
cout<<"Enter student year:";
cin>>object.St_Year;
cout<<"Enter student marks:";
cin>>object.St_Marks;
f2 << object.St_Class << " " << object.St_Year << " " << object.St_Marks << endl;
cout<<"\n";
}
cout<<"\n\n\n\n R.No. Name Class Year Marks \n\n";
ifstream f("studentinfo.txt");
if (f.is_open())
std::cout << f.rdbuf();
return 0;
}