473,396 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Small Game - Ascii image in Console Application

doma23
107 100+
Ciao guys,
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
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. using namespace std;
  5.  
  6. int main() {
  7.     int raspon = 100;
  8.  
  9.     srand(time(0)); //incijalizira generator slucajnih brojeva
  10.     rand();
  11.     //generira slucajni broj izmedju 1 i raspon:
  12.     int trazeniBroj = double(rand()) / RAND_MAX * raspon;
  13.  
  14.     cout << "You need to guess a number between 1 and " << raspon << endl;
  15.     int mojBroj;
  16.     int brojPokusa = 0;
  17.  
  18.     do {
  19.         if (brojPokusa > 9) {
  20.            cout << endl << "The required number is " << -(mojBroj-trazeniBroj) << " positions further." << endl;
  21.            cout << "Aaaaahhhh, come on, you can do better than that." << endl;
  22.         }
  23.         cout << ++brojPokusa << ". guess: ";
  24.  
  25.         cin >> mojBroj;
  26.         if (mojBroj > trazeniBroj)
  27.            cout << "LESS!" << endl;
  28.         else if (mojBroj < trazeniBroj)
  29.              cout << "MORE!" << endl;
  30.     } while (mojBroj != trazeniBroj);
  31.  
  32.     cout << endl << "BINGO!!! Yippee ki-yay... << endl;
  33.  
  34.     system("pause");
  35.     return 0;
  36. }
Oct 29 '10 #1
0 1848

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kishore | last post by:
Hi, I have a small console application written in c# that takes two arguments. I am using System.Diagnostics.Process.Start("cmdApp.exe", arguments) to start the application from another .net...
1
by: Bura Tino | last post by:
Hi, I developing a system using JSP. People familiar with this technology know that ServerPages are easier to maintain than Servlets, but they can only have ASCII output. With that as the...
2
by: Volly | last post by:
Helo ! I want write console application and I want to reuse my old class, but inside it is used Image class (and System.Drawing.Imaging namespace). I can't complile it. The error is: The...
2
by: CM | last post by:
I have C# .net console application compress image using leadtools library. I developed and tested on my machine - XP SP2, .NET Framework 1.1.4322, leadtools v13.0.1.69, and custom library that...
6
by: Krish | last post by:
I want to develop and application that run periodically in the server machine. Now Should I go for a windows service or just create a Console application and schedule it using the windows Task...
10
by: viashino | last post by:
Hi, I have written a Console Application that is doing different things, like checking the status of different network Hosts. I would like to implement a WebInterface to show such status, and...
6
by: dolulob | last post by:
Hi, I'm trying to communicate with a console application through a c# program. the console application is micq a console based ICQ client. I want to be able to send an receive messages through...
4
by: Dinsdale | last post by:
I am writing a small console application that runs fine unless I am re- directing the output to a file (i.e. c:\ app.exe >>output.txt) . I have determined that the issue is caused by the...
1
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I am experimenting with a concept the engineers want. I want to create an app that runs in the console. When an event happens, I want to display an image. Can I do this without having a form?...
5
by: codingZZ | last post by:
How do you convert a console application to a windows service.Any recommendations? The following code is below using System; using System.Collections.Generic; using System.Linq; using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.