Hello. I am new to C++ and I have been spend 4+ hours in the following problem. And I am seeking for help in here. It is due by tonight so please help...
How do I modify the following structure to a program which can...
Part A) Capitalize all the input characters?
Part B) Capitalize only the first letter of each word?
#include <stdio.h>
#include <iostream>
using namespace std;
int main (int argc, char *argv[], char **env)
{
char c, lastc = ' ' ;
c = cin.get() ;
do {
/* conditional expression and converter logic goes here */
cout.put(c) ;
//lastc = c ; // THIS IS IMPORTANT FOR PART B.
c = cin.get() ;
} while ( !cin.eof()) ;
}
Here is the instruction:
Use cin.get() to read (input) from the keyboard character by character
Use the int toupper(int) function to change the alpha characters to uppercase.
Use if (isalpha(c)) to decide if a character is alphabetic.
Lastly, use the cout.put(char) function to output the char.