Thread: Integer to print ASCII

  1. #1
    Unregistered
    Guest

    Question Integer to print ASCII

    Okay I have a program which finds the frequency's of numbers entered in a determined range and it prints out the frequency with a '*'. So if the frequency is four it should print ****. I have the frequency's stored in temp[0], temp[1], ..... So I can print the integer but how do I convert it to print multiple ASCII characters of '*'

    Thanks!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    void c2a( char c ){int x;for(x=0;x<c;x++)putc('*');}

    Quzah.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    197
    Hi,

    This should also solve your problem:
    Code:
    void ntoc(unsigned char c)
    {
    	int n,count;
    	n=c;      /* n is your character number in temp */
    	for(count=0;count<temp[n];count++,putc('*')) ;
    /* temp[n] is so the frequency of you character */
    }
    When I close my eyes nobody can see me...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. it won't print the 0 if i enter 102
    By maybabier in forum C Programming
    Replies: 1
    Last Post: 04-17-2009, 02:13 AM
  2. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 05:07 PM
  3. How do I make a integer into a ascii character?
    By AsleeKaizoku in forum C Programming
    Replies: 5
    Last Post: 01-23-2008, 11:30 PM
  4. Personal Program that is making me go wtf?
    By Submeg in forum C Programming
    Replies: 20
    Last Post: 06-27-2006, 12:13 AM
  5. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 08:13 PM