User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 423,250 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,209 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums

Prog to list ASCII codes (beginners' stuff)

Join Date: Sep 2004
Posts: 11
Reputation: Anu is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Anu Anu is offline Offline
Newbie Poster

Prog to list ASCII codes (beginners' stuff)

  #1  
Sep 24th, 2004
Hi,

I just started a program containing every single prog we have done for school so far and added some private stuff.
Searching through my older files I found a prog which lists all Integers between 1 and 255 and their respective ASCII char, so I decided to include it into my 'collection'.

The problem is that 'twas a Win32 executable and we're working under DOS. Well actually this wouldn't be much of a problem, but the script seems no to work under DOS.

Well, first of here's the script:
  	# include <iostream.h>
   # include <conio.h>

   main()
   {
      int i, j, ip, ipp;
      float k, l;
      char zeichen;
      for (i=1;i<=254;i++)
      {
          zeichen=i;
          cout<<"\n"<<i<<" - "<<zeichen;
          j=1;
          for (j=1;j<=25;j++)
          {
               k=1.0*i/20;
               l=1.0*j;
               if (k==l)
               {
                    ip=i+1;
                    ipp=i+20;
                    if (i<=240) cout<<"\n\n(Press any key -->  "<<ip<<" to "<<ipp<<" )";
                    getch();
                    clrscr();
               };
           }
        }
        getch();
   }

As I stated, no problems under Win32, but under DOS it stops at 26 and after pressing a key again the screen gets cleared again and stays black.

So my question is..is there any way to get something like this running under DOS?

I tried a simple "cin>>intvar; charvar=intvar; cout<<charvar;" aswell, but any value above 25 simply results in nothing being put out.

Well, thanks in advance.~
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 9:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC