Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ program to calculate discount

/*no:Departmental store offers 2.5% discount on shopping of 20,000
and more Rs. 1.5% discount on shopping of 5000 Rs and more.
and no discount on shopping of less than 5000Rs to those customer who have
membership cards. Design a program that accepts total bill
of buyer and membership card(Y/N) as input and calculates amount to be paid after
applying discount?*/

#include<iostream>
using namespace std;
int main()
{
	float a;
	char b;
	cout<<"Enter a Total bill=";
	cin>>a;
	cout<<"Do you a Membership card=";
	cin>>b;
	if(a>=2000&&b=='y')
	{
		cout<<a-(a*2.5/100);
	}
	else if(a>=5000&&b=='y')
		{
			cout<<a-(a*1.5/100);
		}
	else
	cout<<a;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: extends c++ 
Cpp :: C++ mutex lock/unlock 
Cpp :: arduino notone 
Cpp :: convert string into integer in c++ 
Cpp :: c++ fibonacci 
Cpp :: c++ user input 
Cpp :: how to get a letter from the users string in c++ 
Cpp :: string input with space c++ stl 
Cpp :: push front vector cpp 
Cpp :: min element c++ 
Cpp :: read file into vector 
Cpp :: c++ swapping two numbers 
Cpp :: c++ extend class 
Cpp :: adding elements to a vector c++ 
Cpp :: c++ case 
Cpp :: how to write something in power of a number in c++ 
Cpp :: c++ printf char as hex 
Cpp :: c++ function as param 
Cpp :: number of lines in c++ files 
Cpp :: max element in array c++ stl 
Cpp :: c++ create multidimensional vector 
Cpp :: string to decimal c++ strtol 
Cpp :: how to easily trim a str in c++ 
Cpp :: glew32.dll was not found 
Cpp :: append string cpp 
Cpp :: reverse function in cpp string 
Cpp :: c++ cout format 
Cpp :: string to upper c++ 
Cpp :: overload of << c++ 
Cpp :: insert a character into a string c++ 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =