Originally Posted by
xxghostsxx
Code:
struct database
{
int id_number;
int age;
float salary;
};
int main()
{
database employee; //There is now an employee variable that has modifiable
//variables inside it.
employee.age=22;
employee.id_number=1;
employee.salary=12000.21;
return 0;
}
I need help again its show up and disappearing right away.
I tried using system("pause");AND ther other one. but its given me an error. "SYSTEM" UNDECLARED
HELP
Put this at the beginning of your program:
Code:
#include <iostream>
using namspace std;
Including iostream allows you to use cin and cout (input and output). The 'using namespace std' part is the block of code named std that cin and cout are located, but dont worry about that yet.
Then at the point you want it to pause (usually at the end of the program) put:
Code:
cin.ignore();
cin.get();
This leaves you with:
Code:
#include <iostream>
using namspace std;
struct database
{
int id_number;
int age;
float salary;
};
int main()
{
database employee; /* There is now an object of the 'database' that allows you to edit the
variables inside of it, named employee. Object meaning a copy of it. */
employee.age=22;
employee.id_number=1;
employee.salary=12000.21;
cin.ignore();
cin.get();
return 0;
}
Place those two together wherever you want to pause, I would forget about SYSTEM pause, but if you prefer to use it while learning its cool.