I need the first and last names to be capitalized, so if the user inputs a lowercase, it'll change it to uppercase when it's displayed. But it's just the ASCII and I'm not sure how to fix it. Thanks! #include <iostream> #include <cctype> using std::cout; using std::cin; using std::toupper; char firstname[15], lastname[15]; int f = 0, l = 0; int main() { cout << "Enter your last name: " ; cin >> lastname; cout << "Enter your first name: " ; cin >> firstname; f = toupper (firstname[0]); l = toupper (lastname[0]); cout << "Welcome " << firstname << " …

Member Avatar
Member Avatar
+0 forum 1

int numLines = 0; string unused; while (getline(users, unused)) { ++numLines; } cout << numLines << " Clients Found" << endl; //begin the search string search; string line; while(client.empty()) { cout << "Queue: "; //Display What The User Typed getline(cin,search); //Make it capital transform(search.begin(), search.end(),search.begin(), ::toupper); cout << search << endl; getline(users,line); stringstream ss(line); string line_part; //search each line int l = 0; //line variable while(l < numLines) { getline(ss, line_part, '.'); size_t pos; pos=line_part.find(search); // search if(pos!=string::npos) // string::npos is returned if string is not found { if(search == line_part) { cout << "Queue: " << search; cout << …

Member Avatar
Member Avatar
+0 forum 1

Hi guys, I'm writing a small piece of code that will allow the user to input a sentance, and will return the sentance in all uppercase characters. The problem is, as soon as a "space" character is entered the program considers the input to be finished. I don't understand why. At first I thought that maybe it would be the space symbol causing problems so I wrote the code to disregard the character if it was a space symbol. This still didn't help. Also, if I input spaces before writing anything else, the program just skips the spaces, and returns …

Member Avatar
Member Avatar
-1 forum 4

i wrote a program to take text from a file of my choice named "data" and print it out on the screen, how can i tweak this so taht when the text comes out , it would be all in upper case using toupper?? this is the code [CODE]#include <stdio.h> #include <ctype.h> int main () { char ch; char abc; FILE*cfptr=fopen("data.txt" , "r"); ch=fgetc(cfptr); while (ch!= EOF){ printf ("%c", ch); ch=fgetc(cfptr); } fclose (cfptr); printf ("%c", ch); scanf ("%c", abc); //keeps output on screen return (0); } [/CODE] thanks

Member Avatar
Member Avatar
+0 forum 9

I need some help with the toupper code. [code] int main() { char pick; printf("A. Local needs\n"); printf("B. Local Service\n"); scanf("%d",& pick); switch (pick) { case 'a': printf("Hello World"); case 'b': printf("Hello Nation"); } getch() return 0; } [/code] How would i implement the toupper code so i could change pick to upper case if the user entered a common letter. And do i have to # include anything at the top to use toupper?

Member Avatar
Member Avatar
+0 forum 5

The End.