Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASCII characters in C++...

Options
  • 18-02-2002 4:12pm
    #1
    Posts: 0


    This might seem like a completely stupid question but can anyone tell me how to print out ASCII characters in C/C++?

    Will i have to access the registers immediately to select which one i want or is there another way to do this?

    Thanks for any help:)


Comments

  • Registered Users Posts: 1,994 ✭✭✭lynchie


    You were not quite specific on your exact query, but a simple program in C such as



    int main()

    {

    int i=32;

    for(i=32;i<255;i++)

    printf("%c",i);

    }



    Will print out all the ascii chars from 32-255. Is that what you are trying too do??


  • Posts: 0 [Deleted User]


    Yeah, i just wanted to print out, say if i wanted that ASCII smiley face...how would i select the individual code to do it...but you've given me the solution with that last post so thanks!
    :)


  • Closed Accounts Posts: 7,230 ✭✭✭scojones


    int main()
    {
    int i=32;
    for(i=32;i<255;i++)
    printf("%c",i);
    }

    should the above code not be
    int main()
    {
    int i=32;
    for(i=32;i<256;i++)
    printf("%c",i);
    }

    ?????


  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    It's an error alright, it's also incorrect to specify "int main()" without a return line (should be void), but it's kinda irrelevant isn't it? He got the general idea...





    Al.


Advertisement