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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASCII characters in C++...

  • 18-02-2002 3: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, Registered Users 2 Posts: 2,013 ✭✭✭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, Registered Users 2 Posts: 16,414 ✭✭✭✭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