do while loop that changes lowercase to uppercase

I'm new to programming less than 4 days. I'm trying to create a Do While loop that asks the user for a letter, if that letter is lowercase it changes it to uppercase, and if its uppercase it changes to lowercase.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# include <iostream> 
using namespace std;
int main()
{
	int letter; 
	int c,C;
	do 
	{
		cout << "enter c or C (enter A to exit): ";
		cin >> letter; 
		if ( letter = c )
		{
			cout << toupper(letter) << '\n';
		}
		if(letter = C) 
			{
			cout << tolower(letter) << '\n';
		}
		if (letter != c,C)
		{break;}
	}
	
		while (letter = c,C);
		system("Pause");
		return 0;
}


Thank you anybody that can help me.
c is a variable or container, not a value. Also = is an assignment, not a comparison. Also, comma's are not OR operators.

I think you want this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int main()
{
  char letter;
  do
  {
    cout << "enter c or C (enter A to exit): ";
    cin >> letter;
    if ( letter == 'c' || letter == 'C')
    {
      cout << toupper(letter) << '\n';
    }
  } while (letter == 'c' );
  system("Pause");
  return 0;
}
Ah, thank you so much! It worked.
Topic archived. No new replies allowed.