Input works, output doesnt

So it lets me put everything in for the input ID/Name/Test Scores but then It doesn't give me a report back of what was input, how do i do that?

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
#include <iostream>
#include <stdio.h>
#include <conio.h>

using namespace std;
class student
{
      private :
             int sno;
             char name[20];
             int g1,g2,g3;
      public :
             void Getdata()
             {
				 cout << "Enter Student ID:  "; cin >> sno;
				 cout << "Enter Student NAME:  "; cin >> name;
				 cout << "Enter Student TEST SCORES (3):  ";
                 cin >> g1 >> g2 >> g3;
             }
             void Putdata()
             {
                   cout  << "Student ID :" << sno;
                   cout << "Student NAME      :" << name;
				   cout << "Student TEST SCORES (3)     :" << g1 << "  " <<g2<<"  "<<g3;
            }
};

int main()
{
      student s;
      s.Getdata();
      s.Putdata();
      return 0;
}
Does the window close right after you type in the input?
this works fine. if you use visual studio, just press ctrl+f5

otherwise have a look here http://cplusplus.com/forum/beginner/1988/
Last edited on
put this on line 33, move return down 1 line.
getch();
Topic archived. No new replies allowed.