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! >.<
Help with parsing this html
Hi, I've got some html i just need a couple of strings from.. argh, it's freaking me out. I've tried a lot.Here is the html:Code: <div id="Tab01" style="overflow: auto;
AUTONUMBER PROBLEM
Hello Everyone,
question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or should i always put a die() function underneath the header() function?
PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page will use code to pull information from a database and display it on the page in a formatted way.Code:
PHP Tab Control
Hi All,I would like to have PHP tab control with/without Javascript. But I want to retrieve some information from database server when clicking on a tab. Any body had used this kind of tab?Any help
article site help remaining text
Hi all hope you will be fineI am creating a article site in this site i want to put some text on main page and link it via "read more" text from articles page and complete article will be
Tree Menu
Hi guys,Can anyone help me making a tree navigation system? I have a site where I'm allowing users to upload their files to share with each other. They can create folders, but I'm having real
Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont really care if it is a Drop Frame or Non Drop Frame system, it doesnt need to be that accurate. Just
AJAX form submit
I recently built a form that submits data to my database with an ajax function that is called through onClick="function ..." on the submit button. That all works perfectly, however the
problem with sql querry in php script
Hello guys, What I want to do is I want to read out a csv file and then but te conent ot the file in a msql datbase . So far it works but the problem I haven that if I want to let te script to the