#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
char ch, play_or_no_play='y';
while (play_or_no_play == 'y')
{
cout << "Enter a character: ";
cin >> ch;
while (ch != 'c')
{
cout << "Wrong Character, try again: ";
cin >> ch;
}
cout << "\a\a\a\a bingo you got it!" << endl;
cout << "Do you want to play again? ";
cin >> play_or_no_play;
}
system("Pause");
return 0;
}
I need to make it where the character 'c' now becomes a random character a-z
i was looking at this thread http://www.daniweb.com/forums/thread1769.html
trying to change the code to use char instead of int which I have done, but though how to limit it to a-z is little beyond my skill:
yes it is for school, but had a house fire and doing independent study aka do the work and turn it in to get a grade though semester ended or take F I am just not sure if they were at the point of using arrays or if they is some cut and dry one line change that does the trick.
"original question was: In the following program find how to change the character 'c' dynamically to keep the game running"
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
char random_char = rand();
cout << random_char << endl;
system("pause");
return 0;
}