Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Source 

Print ASCII Code (C++)

Code
#include <iostream>
#include <cstdlib>

using namespace std;

void prompt();

int main()
{

    prompt();
    char ans = 'y';


    while (ans == 'y' || ans == 'Y')
    {
        cout << "Try Again(y/n)> ";
        cin >> ans;
        
        if (ans == 'y' || ans == 'Y')
        {
            prompt();

        }
        else
        {
            exit(0);
            
        }
        
            
        

    }
      
    return 0;

    
}

void prompt()
{
    char sing_ch;
    cout << "\n\n Print code (ASCII code / Unicode code etc.) of a  given character:\n";
    cout << "-----------------------------------------------------------------------\n";
    cout << " Input a character: ";
    cin >> sing_ch;

    cout << " The ASCII value of " << sing_ch << " is: " << (int)sing_ch << endl;
    cout << " The character for the ASCII value " << (int)sing_ch << " is: " << (char)((int)sing_ch) << endl << endl;

    
}


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Source] by Emre_Apr 21, 2024 11:15 AM 0 63 Apr 21, 2024 11:15 AM
Last Post: Emre_
[Tutorial] by ClumsyMar 7, 2024 07:46 PM 0 115 Mar 7, 2024 07:46 PM
Last Post: Clumsy
by X-LITDec 13, 2022 06:33 AM 4 148 Dec 13, 2022 06:33 AM
Last Post: Hackers