// Josh Crago_Chapter 7 Programming pg 458, # 7
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;  


int main()
{ 
	
	char again; 
	do
	{    
		// Define the varibles		
		char letter = 0;  	
		const int SIZE = 81;
		char line[SIZE];
		const int maxLowercase = 122;
		const int minLowercase = 97;
		char Count;

	
		// Tell them to enter a lower case.		
		cout << "Enter an lowercase letter: ";  		
		cin >> letter;
		cin.getline(line, 81);

		if(line[Count] >= 97 && line[Count] <= 122)
		{
			if(line[Count] >= minLowercase &&
				line[Count] <= maxLowercase)
				{
				line[Count] = line[Count] - 32;
				}
	}

		for(int Count = 0; Count <= SIZE; Count++);
			line[Count] = 81;



		// Check whether the input is lowercase and	
		// make sure it is between "a" and "z" then convert 	
		// from lower case to upper case 		
		if(letter >= 'a')                    		 
			if (letter <= 'z')                		
			{                                  		 
				letter = letter - 'a'+ 'A';      		
				cout << "The uppercase: " << letter << endl;	
			} 	
			
			// If it is not an upper case letter. 		
			else		cout << "Enter a lowercase letter please.\n";  
			
			// Run it again		
			cout << "Would you like to run it again? [Y/N?] ";		
			cin >> again;		
			cin.ignore(1, '\n');		
	}while (again == 'Y' || again == 'y');
	return 0;
}

I have a warning and cant understand what it is. . If someone can help me I would appreciate it. TY

Recommended Answers

All 2 Replies

It looks to me like you took three different solutions you found on the web and mashed them together into one hideous mess. Compare and contrast:

#include <iostream>

int main()
{
    char ch;

    while ( std::cin.get ( ch ) && ch != '\n' ) {
        if ( 'a' <= ch && ch <= 'z' )
            ch += 'A' - 'a';

        std::cout.put ( ch );
    }

    std::cout.put ( '\n' );
}

Note that there are some non-portable assumptions in the above solution which really only work with ASCII and Unicode. It's far wiser to use the standard std::toupper function.

Now for your actual question:

>I have a warning and cant understand what it is.
The warning is saying that the Count variable hasn't been given a value, but you use it as if it had. Changing char Count; to char Count = 0; will make it go away, but that whole part of the program is nonsensical.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.