I've started to study C++ recently.
I've made a small game in which you must guess a number from 1 to 100. You can see the code below.
What I want to do is to put an image of ascii characters instead of bingo, for example of a lady, like on this website:
http://www.codeproject.com/KB/web-image/AsciiArt.aspx
Anybody know how can I do that?
Thanks!
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- int main() {
- int raspon = 100;
- srand(time(0)); //incijalizira generator slucajnih brojeva
- rand();
- //generira slucajni broj izmedju 1 i raspon:
- int trazeniBroj = double(rand()) / RAND_MAX * raspon;
- cout << "You need to guess a number between 1 and " << raspon << endl;
- int mojBroj;
- int brojPokusa = 0;
- do {
- if (brojPokusa > 9) {
- cout << endl << "The required number is " << -(mojBroj-trazeniBroj) << " positions further." << endl;
- cout << "Aaaaahhhh, come on, you can do better than that." << endl;
- }
- cout << ++brojPokusa << ". guess: ";
- cin >> mojBroj;
- if (mojBroj > trazeniBroj)
- cout << "LESS!" << endl;
- else if (mojBroj < trazeniBroj)
- cout << "MORE!" << endl;
- } while (mojBroj != trazeniBroj);
- cout << endl << "BINGO!!! Yippee ki-yay... << endl;
- system("pause");
- return 0;
- }