Answer to Question #243242 in C++ for Urooj

Question #243242

Write a C++ program on If you have a musical friend, you next need to check (using a nested if statement) that they actually play an instrument you want in the band. You decide that they need to play either guitar or drums to join.


1
Expert's answer
2021-09-28T00:50:06-0400


#include <iostream>
using namespace std;




int main(){
	char answer=' ';
	cout<<"Do you have a musical friend? y/n: ";
	cin>>answer;
	if(answer=='y' || answer=='Y'){
		int ch;
		cout<<"Does he play either 1. guitar, 2. drums, 3. other?: ";
		cin>>ch;
		if(ch==1 || ch==2){
			cout<<"The friend can join.\n";
		}else{
			cout<<"The friend can't join.\n";
		}
	}else{
		cout<<"The friend can't join.\n";
	}


	cin>>answer;
	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