Hi everyone,
I am writing a program that converts numbers to words and vice-versa, like typing on a older cellphone. The user enters as many messages as he wants in numbers and/or text. The first character of the messages indicates what the remaining string is: numbers or letters. I can't seem to find a way to get that first character without errors spawning everywhere. I have tried using cin and getline. If someone could explain what I am doing wrong, that would be great.
Here is what I have:
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
int main()
{
//Declare variables
string indicator;
string input;
//Get input
cout << "Enter your message, starting with '#' for text, and '@' for numbers." << endl;
5 while(input != '*')
16 {
17 cin >> input;
18 //This is where I would place the code to get the indicator
19 //if(#), then textToNumber function.
20 //if(@), then numberToText function.
21 }
22
23 //Display results
24 cin.get();
25 cin.get();
26
27 //Exit program
28 return 0;