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! >.<
Somebody hacked into my site and changed coding >>> URGENT HELP NEEDED <<<
I am not that much into programming , but somebody is hacking to my site and injecting some kind of iframes ... it happened to another site , but that wasn't that important for me, but now it has
Help with file_get_html
The following code gives the expected results:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Generating unique numbers using php
Hi,I need help in generating unique number using php.I tired using rand() in php.But, by using rand() method,the generated values are repeating.I want unique numbers in my application.Every time in
Preventing SQL Injection
I have a question about SQL Injection, In some of our code we use this:
Content-Disposition: attachment; filename=... not working as i thought it should
taken the following code from the php.net site the script is not working.what is not happening is the file does not show and also the file download does not show the correct file name it seems to have
Query output more than expected
$query=mysql_query("SELECT * FROM players, communities, divisions WHERE dob BETWEEN '{$start_date}' AND '{$end_date}' and communities.id=players.community order by communities.community,
Install page
How do I make it so when a user submits information on the Install page, it'll right it into the correct file. I can do the forms and $_POST, but I need it so that it actually works.Current stuff in
Error in write byte array into document in SM58
Hi Gurus,
update post issues
I am trying to create an update to a post function, while the update does occur, the page routing and selecting of posts to be updated is whats getting screwed up. I have so many files involved in
Need help with some php code :)
Hey! I'm quite new to this whole thing, so please don't fire me with shait on this one =DI'm trying to learn PHP and MySQL, and atm I am trying to make a website which corresponds with a database - a