Well, i have a structure, input and output functions, to get some data, now i would like to make the following:
-the user inputs a number (for which i need a dynamic memory reservation)
-and that number declares how many times the input should loop)
so for example the use puts in 4; it will run the input function 4 times he can tpye in stuff for 4 different companyes or w/e ... same with the output
Here is waht i ahev for now:
-the user inputs a number (for which i need a dynamic memory reservation)
-and that number declares how many times the input should loop)
so for example the use puts in 4; it will run the input function 4 times he can tpye in stuff for 4 different companyes or w/e ... same with the output
Here is waht i ahev for now:
Code:
#include <iostream>
using namespace std;
struct comp{
string name;
int obr;
int bill;
int days;
};
void input(comp &x){
cout << "Name: ";
cin >> x.name;
cout << endl;
cout << "Obr: ";
cin >> x.obr;
cout << endl;
cout << "Bill: ";
cin >> x.bill;
cout << endl;
cout << "Days: ";
cin >> x.days;
cout << endl;
}
void output(comp x){
cout << "Name: " << x.name << endl;
cout << "Obr: " << x.obr << endl;
cout << "Bill: " << x.bill << endl;
cout << "Days: " << x.days << endl;
}
int main(){
cout << "Input data: " << endl;
comp x;
input(x);
output(x);
system("PAUSE");
return 0;
}