My assignment says I'm supposed to read in an address all on one line separated by pound signs (eg jane doe # p.o. box 123 # new york, new york 97229 #) and output it with correct capitalization and in proper address format like:
Jane Doe
P.O. Box 123
New York, New York 97229
Also we have to use character arrays, no strings, and cannot use global variables. I've gotten it to output in address format, but I have no idea how to capitalize all the letters that need to be uppercase. This is what I have so far:
#include <iostream>
#include <iomanip>
#include <cctype>
#include <cstring>
using namespace std;
void read(char word[]);
int main ()
{
cout << "Enter address: \n";
char word[40];
do {
read(word);
} while(strcmp(word, "\n") != 0);
return 0;
}
void read(char word[])
{
cin >> word;
if(strcmp(word, "#") != 0)
cout << word << " ";
else
cout << endl;
}