ok cool anyway heres the code of the 2 file 1 project:
Code:
#include <iostream>
using namespace std;
int main()
{ char act;
do {
cout<<"Please choose 1 of a mathematic actions. For multiplying press m, divide - d, add - a, and less - l ";
cin>> act;
int num, num1;
switch (act) {
case 'm':
cout<<"Input 2 numbers to be multiplied(press enter after u choose the one and after the another) \n";
cin>> num;
cin.ignore();
cout<<" x \n";
cout<< endl;
cin>> num1;
cin.ignore();
cout<<"= "<< num * num1;
cin.get();
break;
return 0;
case 'd':
cout<<"Input 2 numbers to be divide\n";cin.ignore();
cin>> num; cin.ignore();
cout<<" : ";
cin>> num1;
cin.ignore();
cout<<" = "<< num / num1;
cin.get();
break;
return 0;
case 'a':
cout<<"Input 2 numbers u choose to add to each one\n";
cin>> num; cin.ignore(); cout<<" + "; cin>> num1;
cin.ignore();
cout<<" = "<< num + num1;
break;
return 0;
cin.get();
case 'l':
cout<<"Input 2 numbers to calculate the first minus the 2nd \n";
cin>> num;
cin.ignore();
cout<<" - ";
cin>> num1;
cin.ignore();
cout<<" = ";
cin.ignore();
cout<<num - num1;
cin.get();
return 0;
}
} while(!(act == 'm' || act == 'd' || act == 'a' || act == 'l'));
}
this was my first 1, with the int main() now heres the 2nd:
Code:
#include <iostream>
using namespace std;
int submain()
{
int x; // A normal integer
int *p; // A pointer to an integer
p = &x; // Read it, "assign the address of x to p"
cin>> x; // Put a value in x, we could also use *p here
cin.ignore();
cout<< *p <<"\n"; // Note the use of the * to get the value
cin.get();
return 0;
}