All pastes #716817 Raw Edit

NameFixer

public cpp v1 · immutable
#716817 ·published 2007-09-27 04:36 UTC
rendered paste body
/*Title: Name FixerAuthor: Vanessa SchagererDate: 9/20/07Description: Takes user input name and changes it to be written correctly			with only the first letter capitalized and the rest lower case.*/#include <iostream>using namespace std;int main(){	char ch, cont = 'y';	while(cont == 'Y' || cont == 'y')	{		cout << "Please enter your name: \n";		cin.get(ch);		if('A' <= ch && ch <= 'Z')		{			cout << ch;		}		else if('a' <= ch && ch <= 'z')		{			ch = ch - ('a' - 'A');			cout << ch;		}		cin.get(ch);		if('a' <= ch && ch <= 'z' && ch != ' ')		{			while('a' <= ch && ch <= 'z' && ch != ' ')			{				cout << ch;				cin.get(ch);				while('A' <= ch && ch <= 'Z' && ch != ' ') 				{					ch = ch + ('a' - 'A');					cout << ch;					cin.get(ch);				}			}		}		else if('A' <= ch && ch <= 'Z' && ch != ' ')		{			while('A' <= ch && ch <= 'Z' && ch != ' ')			{				ch = ch + ('a' - 'A');				cout << ch;				cin.get(ch);				while('a' <= ch && ch <= 'z' && ch != ' ')				{					cout << ch;					cin.get(ch);				}			}		}		if(ch == ' ')		{			cout << ' ';			cin.get(ch);			if('a' <= ch && ch <= 'z')			{				ch = ch - ('a' - 'A');				cout << ch;			}			else				cout << ch;					cin.get(ch);			if('a' <= ch && ch <= 'z' && ch != ' ')			{				while('a' <= ch && ch <= 'z' && ch != ' ')				{					cout << ch;					cin.get(ch);					while('A' <= ch && ch <= 'Z' && ch != ' ') 					{						ch = ch + ('a' - 'A');						cout << ch;						cin.get(ch);					}				}			}			else if('A' <= ch && ch <= 'Z' && ch != ' ')			{				while('A' <= ch && ch <= 'Z' && ch != ' ')				{					ch = ch + ('a' - 'A');					cout << ch;					cin.get(ch);					while('a' <= ch && ch <= 'z' && ch != ' ')					{						cout << ch;						cin.get(ch);					}				}			}		}		cout << "\n Would you like to enter another name? (Y/N) ";		cin >> cont;	}		return 0;}