use dev c ++ for compile
#include<iostream.h> main() { //Declaring Constants const float SUPER = 106.50; const float HIOCTAIN = 110.65; const float DIESEL = 103.35; int input_data, input_method; float input_amount, input_quantity, w, x, y, z; double output_amount; char go_back; y=1; start: //Showing Welcome Message with Option to Select the Fuel Type; cout << "Alsalam o Alikum. Good Day." << "\n" << "Please Select the Fuel Type from options given Below :" << "\n"; cout << "1) Super"; cout << "\n" << "2) Hi-Octain"; cout << "\n" << "3) Diesel" << "\n"; cin >> input_data; cout << "\n"; //Getting Data from User if (input_data == 1){ cout << "You Selected Super. The Rate is " << SUPER <<"0 Per Liter" << "\n" << "\n"; } else if (input_data == 2){ cout << "You Selected Hi-Octain. The Rate is " << HIOCTAIN <<" Per Liter" << "\n"; } else if (input_data == 3){ cout << "You Selected Diesel. The Rate is " << DIESEL <<" Per Liter" << "\n"; } cout << "Please Select from the List the Amount or Quantity" << "\n"; cout << "1) Amount"; cout << "\n" << "2) Quantity" << "\n"; cin >> input_method; cout << "\n"; if (input_method == 1){ cout << "\n" << "Please Enter the Amount (In Rupees) against which you want to get fuel" << "\n"; cin >> input_amount; cout << "\n"; } else if (input_method == 2){ cout << "\n" << "Please Enter the Quantity of fuel (In Liters)" << "\n"; cin >> input_quantity; cout << "\n"; } //Processing Data and Giving the Output using "And" and "or" logics if (input_data == 1 && input_method == 1){ x = input_amount/SUPER; output_amount = x * SUPER; cout << "\n" << "You Refuled " << x << " Liters of Super. Your Amount is " << output_amount << "\n"; } else if (input_data == 1 && input_method == 2){ output_amount = SUPER * input_quantity; cout << "\n" << "You Refuled " << input_quantity << " Liters of Super. Your Amount is " << output_amount << "\n"; cout << "Thanks for Coming. God Bye" << "\n"; } else if (input_data == 2 && input_method == 1){ x = input_amount/HIOCTAIN; output_amount = x * HIOCTAIN; cout << "\n" << "You Refuled " << x << " Liters of Hi-Octain. Your Amount is " << output_amount << "\n"; cout << "Thanks for Coming. God Bye" << "\n"; } else if (input_data == 2 && input_method == 2){ output_amount = HIOCTAIN * input_quantity; cout << "\n" << "You Refuled " << input_quantity << " Liters of Hi-Octain. Your Amount is " << output_amount << "\n"; } else if (input_data == 3 && input_method == 1){ x = input_amount/DIESEL; output_amount = x * DIESEL; cout << "\n" << "You Refuled " << x << " Liters of Diesel. Your Amount is " << output_amount << "\n"; } else if (input_data == 3 && input_method == 2){ output_amount = DIESEL * input_quantity; cout << "\n" << "You Refuled " << input_quantity << " Liters of Disel. Your Amount is " << output_amount << "\n"; } else { cout << "Wrong Entry. Try Again!!" << "\n"; } cout << "Please Press 'Y' for another refule or press 'N' to exit" << "\n"; cin >> go_back; if (go_back == 'y' || go_back == 'Y'){ goto start; } else { cout << "Thanks for Coming. God Bye" << "\n"; } system ("pause"); //end of the programme }
|
Friday, April 18, 2014
use dev c ++ for compile
Subscribe to:
Post Comments (Atom)







No comments:
Post a Comment