Answer to Question #324693 in C++ for ness

Question #324693

Can you identify if Cody's name is spelled right? If so, then make a program that accepts four one-letter strings separated by space and print "Correct" if the inputted strings, combined in order, spell the name Cody correctly. If not, print "Wrong". It doesn't matter if it's in uppercase or lowercase, as long as it's spelled correctly, it's considered correct.


Now, will you take on this task?


input

1.First Character

2.Second Character

3.Third Character

4.Fourth Character


1
Expert's answer
2022-04-08T07:57:44-0400
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string s = "cody";
	string tmp = "";
	char c;
	for (int i = 0; i < 4; i++)
	{
		cout << "Please, enter " << i + 1 << " character: ";
		cin >> c;
		tmp += tolower(c);
	}
	if (tmp == s)
		cout << "Correct";
	else
		cout << "Wrong";
	
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS