Answer to Question #262670 in C++ for Rille

Question #262670

A weather station validates the rain into its critical level by its raindrops fell. Make program


that will input number of raindrops fell, Check if raindrops fell is equal to 10,000 then display


“CRITICAL RAIN”. Your program will be terminated if you input zero in the raindrops fell.

1
Expert's answer
2021-11-09T23:39:33-0500


SOLUTION TO THE ABOVE QUESTION


SOLUTION CODE


#include <iostream>
using namespace std;


int main(int argc, char** argv) {
	int terminate_condition = 1;
	//define a while loop that will terminate when condition == 0 i.e rain drops number == 0
	while(terminate_condition==1)
	{
	   cout<<"\nEnter the number of raindrops fell: ";
       int number_of_rain_drops;
       cin>>number_of_rain_drops;
       if(number_of_rain_drops==10000)
	   {
	   	cout<<"\nCRITICAL RAIN"<<endl;
	  }	
	  else if(number_of_rain_drops==0)
	  {
	  	//set terminate condition to zero to exit the while loop
	  	terminate_condition=0;
	  	//print exit message
	  	cout<<"Program successfully exited"<<endl;
	  }
	  else if(number_of_rain_drops>10000)
	  {
	  	cout<<"\nMORE THAN CRITICAL RAIN"<<endl;
	  }
	  else if(number_of_rain_drops>0)
	  {
	  	cout<<"\nAVERAGE RAIN"<<endl;
	  }
	  else
	  {
	  	cout<<"\nNumber of rain drops can't be negative"<<endl;
	  }
	}
   
	return 0;
}


SAMPLE PROGRAM OUTPUT






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