new to programing need help!!

This is a discussion on new to programing need help!! within the C++ Programming forums, part of the General Programming Boards category; Hellif o,
This is probably a simple fix for the experienced programer,
I am trying to have the user input ...

new to programing need help!!

I am trying to have the user input three letters of his choice and then out put those letters in reverse order.

This is what I have so far:

Code:

//A program that prints out the letters in reverse of the users input
#include<iostream>
using namespace std;
int main()
{
char ABC;
char reverse;
char letters;
char CBA;
//tells the user what is going to happen
cout<<"This program will reverse the three letters you input\n";
cout<<"Please enter three letters====>ABC\n";
cin>>letters;
reverse=CBA;
cout<<"Here are the letters in reverse<<CBA\n";
return 0;
}

As you can see I am a real beginner.

Thank in advance

Last edited by Dave_Sinkula; 09-09-2006 at 02:49 PM.
Reason: Added [code][/code] tags -- learn to use them yourself.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

An alternative would be to use getch() (unstandard), from conio.h. there are lots of examples onthe boards, search for it if you're interested. This doesn't require the user to press return whenever they enter a key. However, there are bad things about it, mainly it being non-standard.

do not be worried! There is an alternative! Arrays of characters, or std::string 's.

Code:

char Letters[3];

holds info for a number of letters, instead of the char letter; that you would have had (notice the added s).

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell

Please post the full text of the error and point out the line that it refers to.Also please use [code][/code] tags when posting code.

In the code above, you have semicolons after your if expressions (e.g. "if (anual_income<=12000);"). Remove those. You also have some brace issues. Finally, you can't use % in theinitialization of variables, what were you trying to do there?