Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 12-11-2008
Member
 
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?
Reply With Quote
  #2  
Old 12-11-2008
Member
 
Join Date: May 2008
Posts: 186
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.
Reply With Quote
  #3  
Old 12-11-2008
Member
 
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); 
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "C++ program to display ASCII code of a word or phrase"
Thread Thread Starter Forum Replies Last Post
How to extract a word from phrase from Excel columns Kumar esan MS Office Support 5 24-02-2012 05:17 PM
How do I search files containing ?a word or phrase in the file? in windows 7 Mewad Operating Systems 4 18-01-2011 09:46 AM
Program to determine a word or a phrase is a palindrome in C/C++ Lambard Software Development 4 09-12-2008 07:23 PM
ASCII Code Table in SQL SuB-Zero Software Development 1 10-11-2008 02:44 PM


All times are GMT +5.5. The time now is 12:38 AM.