VB icon

peso amount

Email
Submitted on: 1/8/2015 7:54:00 PM
By: MICHAEL ESPIRITU (from psc cd)  
Level: Beginner
User Rating: By 2 Users
Compatibility: C, C++ (general), Microsoft Visual C++
Views: 977
 
     
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: peso amount
// Description:
// By: MICHAEL ESPIRITU (from psc cd)
//**************************************

#include<iostream.h>
int main()
{
	float number;
	int passnumber;
	float origvalue;
	float passcent;
	int Thousand,Hundred1,Hundred2,Hundred3,Fifty,Twenty,Ten;
	int Five,One,TwentyFivecent,Tencent,Fivecent;
	cout<< "Enter Peso Amount: "<<" ";
cin>>number;
	origvalue=number;
	passnumber=number; 
//100 thousand;
	passnumber=passnumber/1000;
	if (passnumber==0)
	{
		passnumber=number;
		Thousand=0;
	}
	else
	{
		Thousand=passnumber;
		number=number-(Thousand*1000);
		origvalue=number;
		passnumber=number;
	}
	//500 hundred
		passnumber=passnumber/500;
	if (passnumber==0)
	{
		passnumber=number;
		Hundred1=0;
	}
	else
	{
	Hundred1=passnumber;
		number=number-(Hundred1*500);
		origvalue=number;
		passnumber=number;
	}
	//200 hundred
passnumber=passnumber/200;
	if(passnumber==0)
	{
		passnumber=number;
	Hundred2=0;
	}
	else
	{
		Hundred2=passnumber;
		number=number-(Hundred2*200);
		origvalue=number;
		passnumber=number;
	}
	//100 hundred
passnumber=passnumber/100;
	if(passnumber==0)
	{
		passnumber=number;
		Hundred3=0;
	}
	else
	{
	Hundred3=passnumber;
		number=number-(Hundred3*100);
		origvalue=number;
		passnumber=number;
	}
	//50 pesos
passnumber=passnumber/50;
	if(passnumber==0)
	{
		passnumber=number;
		Fifty=0;
	}
	else
	{
		Fifty=passnumber;
		number=number-(Fifty*50);
		origvalue=number;
	}
	//Twenty pesos
passnumber=passnumber/20;
	if(passnumber==0)
	{
		passnumber=number;
	Twenty=0;
	}
	else
	{
	Twenty=passnumber;
		number=number-(Twenty*20);
		origvalue=number;
		passnumber=number;
	}
	
	//TEN PESOS
passnumber=passnumber/10;
	if(passnumber==0)
	{
		passnumber=number;
		Ten=0;
	}
	else
	{
	Ten=passnumber;
		number=number-(Ten*10);
		origvalue=number;
		passnumber=number;
	}
	//FIVE PESOS
passnumber=passnumber/5;
		
	if(passnumber==0)
	{
		passnumber=number;
	Five=0;
	}
	else
	{
		Five=passnumber;
		number=number-(Five*5);
		origvalue=number;
		passnumber=number;
	}
	//ONE PESOS
passnumber=passnumber/1;
	if(passnumber==0)
	{
	One=0;
		passcent=origvalue;
	}
	else
	{
		One=passnumber;
		origvalue=origvalue-(One*1);
	}
	//25 cents
passcent=passcent/.25;
	if(passcent<.25)
	{
		passcent=origvalue;
	TwentyFivecent=0;
	}
	else
	{
		TwentyFivecent=passcent;
		origvalue=origvalue-(TwentyFivecent*.25);
		passcent=origvalue;
	}
	//10 cents
passcent=passcent/.10;
	if(passcent<.10)
{
		passcent=origvalue;
	Tencent=0;
	}
	else
	{
	Tencent=passcent;
		origvalue=origvalue-(Tencent*.10);
		passcent=origvalue;
	}
	//5 cents
		passcent=passcent/.05;
	if(passcent<.05)
	{
		passcent=origvalue;
		Fivecent=0;
	}
	else
	{
	Fivecent=passcent;
	}
	cout<<"\nPeso Number of 1 thousand: "<<Thousand<<"\n";
cout<<"\nPeso Number of 5 hundred: "<<Hundred1<<"\n";
	cout<<"\nPeso Number of 2 Hundred: "<<Hundred2<<"\n";
	cout<<"\nPeso Number of 1 Hundred: "<<Hundred3<<"\n";
	cout<<"\nPeso Number of 50 Peso: "<<Fifty<<"\n";
	cout<<"\nPeso Number of 20 Peso: "<<Twenty<<"\n";
	cout<<"\nPeso Number of 10 Peso: "<<Ten<<"\n";
	cout<<"\nPeso Number of 5 Peso: "<<Five<<"\n";
	cout<<"\nPeso Number of 1 Peso: "<<One<<"\n";
	cout<<"\nPeso Number of 25 cent: "<<TwentyFivecent<<"\n";
	cout<<"\nPeso Number of 10 cent: "<<Tencent<<"\n";
	cout<<"\nPeso Number of 5 cent: "<<Fivecent<<"\n\n\n";
	return 0;
	}


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.