Integer to print ASCII

This is a discussion on Integer to print ASCII within the C Programming forums, part of the General Programming Boards category; Okay I have a program which finds the frequency's of numbers entered in a determined range and it prints out ...

  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, 03:13 AM
  2. merging linked lists
    By scwizzo in forum C++ Programming
    Replies: 15
    Last Post: 09-14-2008, 06: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, 01:13 AM
  5. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 09:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21