Hi, ive only started programming recently and as my second assignment i have to write a program that can convert uppercase letters to lowercase letters and visa-versa. i also have to make it stop when a full-stop is entered and count the number of times the program changed letter case.

i have it all written but i dont know how to count the number of times the letter changed case.

could you please help me.

Here is what i have so far:

#include <iostream>
using namespace std; 

int main () 

    char choice;    
    cout << "Enter a full stop to end the program" << endl;

    cout << "Enter the letter you want to be converted:";  
    cin >> choice;

    cout<<"The upper case letter corresponding is:" << choice << endl;

    else if
    cout << "The lower case letter corresponding is:" << choice << endl;

    cout << choice <<" is not a letter!!" << endl;
    while (choice != 46);

    return 0;

PS its not actually in green in my program, thats just to make it easier to see what my program is.


Edited 3 Years Ago by Reverend Jim: Fixed formatting

Declare an integer counter at the start of the program, increment it every time you change case, at the end of while loop read the value of the counter.

To post code use the code tags

. This will properly indent your code and make it easier to read.

This question has already been answered. Start a new discussion instead.