I made a program here is my code:
#include
#include
#include
#include
using namespace std;
int main()
{
unsigned seed = 0;
int randomNum;
int randomNum1;
int number;
int answer;
srand(time(0));
randomNum = 1 + rand() % 50;
randomNum1 = 1 + rand() % 50;
number = randomNum + randomNum1;
cout << "Key in a number for the Random Number seed" << endl;
cout << "and hit the Enter key to display an addition problem. ";
cin >> seed;
cout << setw (9) << randomNum << endl;
cout << "+";
cout << setw (8) << randomNum1 << endl;
cout << setw (9) << "----" << endl;
cin >> answer; // This is what I need to be coded right!
if (answer == number)
cout << "Congratulations! That's right." << endl;
else
cout << "Sorry, the correct answer is " << number << endl;
return 0;
}
The problem is that for the cin answer I want it to be like this format:
space 49
+space 10 //ignore the space the forum wont let me do it proper but basically line
----- all the numbers up even the cin answer
space ##
I tried to do
cin >> setw (9) >> answer; and also
cin >> right >> setw (1) >> answer;
and nothing happened basically my ? is how do I get the user to input his answer in the same lineup of the other 2 random numbers generated! any help would be GREATLY APPRECIATED LOL spent like 1-2 hours looking around the web for a case like this and NOTHING! >.<
single values into sql field
i have a form which i want the user to able to select multiple answers. But i want the answers to be stored into a single field on the mysql table in the back end. e.gthe user may select red + blue +
email form (cannot find the problem)
Hello there. I've been having trouble with an email form. Can't find the problem really. I've tested so many times, tried different ifs to see where the problem comes from. It turned out its alway the
Ball movement
I want to move a ball from one point to another and it should hit a group of balls at the other end and scatter them.Could You kindly explain with sample code?
Filename like the user name
I am creating a form and storing the values in file. Could anyone please tell me how to write a code in php for creating a filename based on the user name as in the form.Thanks
How to show a complete textarea ??
I enter Client Case Notes notes in a textarea field on a PHP form. The field is 5 rows deep and 70 chars wide , using the scroll bar to see beyond 5 lines.After entering notes, I want to echo or print
I need help with formatting date from mysql! with php!
Hello guys*Note: this is a php question not MySQL question, please do not move it to mysql section! Thank you.anyway, I have a record from the database as 2009-12-31 23:59:59I needed to when ever I
Map.php
I am a complete beginner to PHP and am looking for some help with a program I am messing around with.I found this incomplete source code, and I wanted to finish it, but I have no idea what I am
array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.the following code yields me the correct order and number of votes for each movie$compare = array_count_values
SESSION CHECK WORKS "MOST" of the time... whats going on?
i have a sign in check thats included in every page that is a members only page which is basically all of my pages. that im working on anyways..but heres the code..... that works MOST of the time.
Deleting Partners on the Customer Master.
Does SAP handle removing the Partner from Open Sales Orders when a Partner is deleted in the Customer Master. For us, this is not happening, this there some config that must be turned on for this to