Somehow I still haven't been able to get this code to do what I want it to do. Seems like I cant get the loops right. It debugs but I'm trying to make it in such a way that I can end it anytime with an input of -1. Also, if guess > 100 or guess < 1, then it should print "Out of range". Can you guys help me out? I'm dying over here lol
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main(void) {
srand(time(NULL));
while(true) {
int number = rand() % 100 + 1;
int guess;
int tries = 0;
char answer;
while(true) {
cout << "Enter a number between 1 and 100 (" << 1000000 - tries << " tries left): ";
cin >> guess;
How is that any different from your first post... Edit your first post, and follow the instructions in that link.
There is a format button when you click edit, there is an icon <>. Mark all of your code then press it. Just like the link tells you - http://www.cplusplus.com/articles/jEywvCM9/
yea dude, what you can do is click the edit icon on the bottom corner of the post and highlight all code text then click the code tags button. Then delete your reposts.