Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I want to make a c++ program that behaves like scrabble. I want to make certain

ID: 3542895 • Letter: I

Question

I want to make a c++ program that behaves like scrabble. I want to make certain letters worth certain points. And I want the program to be executed once the user types in a period. Specifically, I want al vowels to be worth 1 point and the letters L, T, and M to be worth 4,5, and 6 points. All other letters will be worth no points. At the end of the program, I want to sum up the total of points. How do I do this using a while loop?

P.S.. I am only in the basics of c++ so it shouldn't be too complicated.

Explanation / Answer

please rate - thanks


not sure if this is what you're looking for

can be done with if too


#include <iostream>
using namespace std;
int main()
{char c;
int total=0;
cout<<"Enter you turn: ";
cin>>c;
while(c!='.')
    {switch(c)
       {case 'A': case 'a':
        case 'E': case 'e':
        case 'I': case 'i':
        case 'O': case 'o':
        case 'U': case 'u':    total+=1;
                               break;
        case 'L': case 'l':    total+=4;
                               break;
        case 'T': case 't':    total+=5;
                               break;
        case 'M': case 'm':    total+=6;
                               break;
        }
      cin>>c;
      }        
cout<<"Total score: "<<total<<endl;
system("pause");
return 0;
}
               
                                                                     
            

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote