Full Question:
“Make a program that works when you type the number 99, otherwise, it won’t work and the program will be terminated. When the user type 99, a Welcome message appears, and the program will ask the user to type “two integers”, after that a list of operations will be done using these two integers (Adding them together, Subtract one of the other, Divide one on the other, Multiply one by the other and finally Subtract the 1st integer from 3). When all of those operations’ results done and displayed, the program asks the user again if he wants to continue using this “Operation Program” with new values then he have to type 99, otherwise, the program will stop”.
Full Code:
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 54 55 | #include <iostream> using namespace std; int main() { int numberme; int numberyou; int sum; int sub; int divide; int mult; int result; int password = 0; cout << "To Start the program type 99, otherwise, type any integer to stop: \n"; cin >> password; while( password == 99) { cout << "\nWelcome to the Operation program!, done by Q8iEnG! \n"; cout << "\nPlease, write an integer: "; cin >> numberme; // this variable to save the first integer in it. cout << endl; // to output new line. cout << "Write the second integer: "; cin >> numberyou; // this variable to save the second integer in it. cout << endl; cout << endl; sum = numberme + numberyou; // this how we add between any two numbers using variables. sub = numberme - numberyou; // this how we subtract between any two numbers using variables. divide = numberme / numberyou; // this how we divide between any two numbers using variables. mult = numberme * numberyou; // this how we multiply between any two numbers using variables. result = numberme - 3; // subtracting the first number from 3, you can use any number for any operation. cout << "The sum of the two integers you want is: " << sum; cout << endl; cout << "The subtraction of the two integers you want is: " << sub; cout << endl; cout << "The division of the two integers you want is: " << divide; cout << endl; cout << "The multiplication of the two integers you want is: " << mult; cout << endl; cout << "Subtracting the first integer from 3: " << result; cout << endl; cout << endl; cout << "Thanks for using this Operation Program.!\n\n"; cout << "To continue the program type 99, otherwise, type any integer to stop: \n"; cin >> password; } return 0; } |
Sample Output:
To Start the program type 99, otherwise, type any integer to stop:
99Welcome to the Operation program!, done by Q8iEnG!
Please, write an integer: 2
Write the second integer: 3
The sum of the two integers you want is: 5
The subtraction of the two integers you want is: -1
The division of the two integers you want is: 0
The multiplication of the two integers you want is: 6
Subtracting the first integer from 3: -1Thanks for using this Operation Program.!
To continue the program type 99, otherwise, type any integer to stop:
0
Press any key to continue
Full Question:
“Make a program that copies a file from one directory to another one, using C++”
Full Code:
1 2 3 4 5 6 7 8 9 10 11 12 | #include <iostream> #include <windows.h> using namespace std; int main() { CopyFile("E:\\programfiles\\onepiece.txt", "C:\\hello\\onepiece.txt", false); return 0; } |
Full Question:
“Write C++ Code that opens notepad when it is executed”.
Full Code:
1 2 3 4 5 6 7 | #include <iostream> using namespace std; int main() { system( "START notepad" ); return 0; } |