Answer to Question #181315 in C++ for naufal

Question #181315

Write a program that ask user to enter type. Print "Credit Card" if the type is CC, and if the type is CS print "Cash". Otherwise, print "Invalid Payment".


1
Expert's answer
2021-04-14T13:16:29-0400
using namespace std;


main(void)
{
	char text[2],Flag=0;
	string s;
  	cout <<"\nEnter CC for Credit Card or CS for Cash: ";
  	cin>>text;
  	s=text;
  	if(s=="CC" || s=="cc" || s=="cC" || s=="Cc")		{Flag=1; cout<<"\n\tCredit Card";}
  	if(s=="CS" || s=="cs" || s=="cS" || s=="Cs")		{Flag=1; cout<<"\n\tCash";}
  	if(Flag==0) cout<<"\n\tInvalid Payment";
  	return(0);
}

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