This beginner's program I am trying to make is basically a program where a truly random number is generated and the "player" has to guess the number. The computer will respond "too high" or "too low" until the player guesses the right number.
I got this program idea from some website, and thought I should roll with it. This is my second program- my first being a simple I/O program.
Here is my code:
// BracketingSearch.cpp
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <ctime>
#include <istream>
#include <fstream>
using namespace std;
int main()
{
int x = srand(time(0));
cout << x << endl;
for (int x = 1; x <= 10; x++) {
cout << 1 + (rand() % 100) << endl;
}
string stall;
getline(cin, stall);
}
Side notes:
I don't think I need that many headers; I am still getting use to the c++ libraries.
Please critique my code as much as possible. I am eager to learn programming!
The string stall
is just to make my console application pause for input, so I can see the results.
Thank you for everyone who can help! -Mike