Results 1 to 3 of 3

Thread: C++ program to display ASCII code of a word or phrase

  1. #1
    Join Date
    Feb 2008
    Posts
    324

    C++ program to display ASCII code of a word or phrase

    I am looking for a C++ program that would allow me to display the ASCII code of a word or phrase itself. Can any one help me?

  2. #2
    Join Date
    May 2008
    Posts
    188

    Re: C++ program to display ASCII code of a word or phrase

    Basically the letters "A" to "Z" has the value of 65 to 90 while the letters "a" to "z" has the value of 97 to 122 in ASCII code. Try the C++ program based on this on your own.

  3. #3
    Join Date
    Feb 2008
    Posts
    324

    Re: C++ program to display ASCII code of a word or phrase

    Thank you for your response.

    I have made the basic model of the program based on your guidance, but again got the problem.

    So the program that I started works as planned, but only for a word and not for a full sentence.

    Here is the program:
    Code:
    #include <iostream> 
    #include <cstring> 
    using namespace std; 
    int i, length, JC; 
    string clear; / / Declaration of clear chain 
    
    int main () 
    {
    cout << "Enter the clear text:";
    cin >> clear; // Entering the clear chain 
    length = clear.length(); // Set the length of chain length 
    cout << endl; 
    cout << length << endl; // Display the length of the string 
    cout << endl; 
    for (i = 0; i < length; i++) 
    {
    JC = int (clear[i]) + int (3); 
    if ((JC >= 90 && JC < 97) || (JC > 122)) 
    { 
    JC = JC - 26; 
    } 
    cout << char (JC); 
    } 
    cout << endl; 
    system ("pause"); 
    return (0); 
    }

Similar Threads

  1. How to extract a word from phrase from Excel columns
    By Kumar esan in forum MS Office Support
    Replies: 5
    Last Post: 24-02-2012, 05:17 PM
  2. Replies: 4
    Last Post: 18-01-2011, 09:46 AM
  3. Program to determine a word or a phrase is a palindrome in C/C++
    By Lambard in forum Software Development
    Replies: 4
    Last Post: 09-12-2008, 07:23 PM
  4. ASCII Code Table in SQL
    By SuB-Zero in forum Software Development
    Replies: 1
    Last Post: 10-11-2008, 02:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,560,579.72963 seconds with 17 queries