fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <stdlib.h>
  4. using namespace std;
  5. main(){
  6. int note[5],coin[3],x,count[8],show[8],bath=0;
  7. string kind;
  8. coin[0] = 1;
  9. coin[1] = 5;
  10. coin[2] = 10;
  11. note[0] = 20;
  12. note[1] = 50;
  13. note[2] = 100;
  14. note[3] = 500;
  15. note[4] = 1000;
  16. count[0] = 0; count[1] = 0; count[2] = 0; count[3] = 0;
  17. count[4] = 0; count[5] = 0; count[6] = 0; count[7] = 0;
  18. for(;;){
  19. cout<<"Please enter\"coins\"or\"notes\"."<<endl;
  20. cin>>kind;
  21. if(kind=="coins"){
  22. system("cls");
  23. cout<<"Enter type of types and amount of coins.(1 5 10)\nex. 5 2\n"<<endl;
  24. cin>>kind>>x;
  25. if(kind=="1") {bath +=(count[0] +=(coin[0]*x));}
  26. if(kind=="5") {bath +=(count[0] +=(coin[1]*x));}
  27. if(kind=="10") {bath +=(count[0] +=(coin[2]*x));}
  28. cout<<endl;
  29. cout<<"\t"<<(show[0])=count[0]/coin[0])<<"\t1\tcoin(s)"<<endl;
  30. cout<<"\t"<<(show[1])=count[1]/coin[1])<<"\t5\tcoin(s)"<<endl;
  31. cout<<"\t"<<(show[2])=count[2]/coin[2])<<"\t10\tcoin(s)"<<endl;
  32. cout<<"\t"<<(show[3])=count[0]/note[0])<<"\t20\tcoin(s)"<<endl;
  33. cout<<"\t"<<(show[4])=count[1]/note[1])<<"\t50\tcoin(s)"<<endl;
  34. cout<<"\t"<<(show[5])=count[2]/note[2])<<"\t100\tcoin(s)"<<endl;
  35. cout<<"\t"<<(show[6])=count[3]/note[3])<<"\t500\tcoin(s)"<<endl;
  36. cout<<"\t"<<(show[7])=count[4]/note[4])<<"\t1000\tcoin(s)"<<endl;
  37. cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
  38. }else{
  39. if(kind == "notes"){
  40. system("cls");
  41. cout<<"Enter types of types and amount of notes.( 20 50 100 500 1000)\nex.100 5\n" <<endl;
  42. cin>>kind>> x;
  43. if (kind == "20") {bath +=(count[3]) +=(note[0]*x));}
  44. if (kind == "50") {bath +=(count[4]) +=(note[1]*x));}
  45. if (kind == "100") {bath +=(count[5]) +=(note[2]*x));}
  46. if (kind == "500") {bath +=(count[6]) +=(note[3]*x));}
  47. if (kind == "1000") {bath +=(count[7]) +=(note[4]*x));}
  48. cout<<endl;
  49. cout<<"\t"<<(show[0])=count[0]/coin[0])<<"\t1\tcoin(s)"<<endl;
  50. cout<<"\t"<<(show[1])=count[1]/coin[1])<<"\t5\tcoin(s)"<<endl;
  51. cout<<"\t"<<(show[2])=count[2]/coin[2])<<"\t10\tcoin(s)"<<endl;
  52. cout<<"\t"<<(show[3])=count[0]/note[0])<<"\t20\tcoin(s)"<<endl;
  53. cout<<"\t"<<(show[4])=count[1]/note[1])<<"\t50\tcoin(s)"<<endl;
  54. cout<<"\t"<<(show[5])=count[2]/note[2])<<"\t100\tcoin(s)"<<endl;
  55. cout<<"\t"<<(show[6])=count[3]/note[3])<<"\t500\tcoin(s)"<<endl;
  56. cout<<"\t"<<(show[7])=count[4]/note[4])<<"\t1000\tcoin(s)"<<endl;
  57. cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
  58. }else{ if (( kind != "coins")&&(kinds != "notes")) {
  59. system("cls"); cout << "incorrect type!";}}
  60. }
  61. }
  62. }
  63.  
Success #stdin #stdout 0.02s 26048KB
stdin
Standard input is empty
stdout
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
main(){
	int note[5],coin[3],x,count[8],show[8],bath=0;
	string kind;
	coin[0] = 1;
	coin[1] = 5;
	coin[2] = 10;
	note[0] = 20;
	note[1] = 50;
	note[2] = 100;
	note[3] = 500;
	note[4] = 1000;
	count[0] = 0; count[1] = 0; count[2] = 0; count[3] = 0;
	count[4] = 0; count[5] = 0; count[6] = 0; count[7] = 0;
	for(;;){
		cout<<"Please enter\"coins\"or\"notes\"."<<endl;
		cin>>kind;
		if(kind=="coins"){
			system("cls");
			cout<<"Enter type of types and amount of coins.(1 5 10)\nex. 5 2\n"<<endl;
			cin>>kind>>x;
			if(kind=="1") {bath +=(count[0] +=(coin[0]*x));}
			if(kind=="5") {bath +=(count[0] +=(coin[1]*x));}
			if(kind=="10") {bath +=(count[0] +=(coin[2]*x));}
            cout<<endl;
         	cout<<"\t"<<(show[0])=count[0]/coin[0])<<"\t1\tcoin(s)"<<endl;
			cout<<"\t"<<(show[1])=count[1]/coin[1])<<"\t5\tcoin(s)"<<endl;
			cout<<"\t"<<(show[2])=count[2]/coin[2])<<"\t10\tcoin(s)"<<endl;
			cout<<"\t"<<(show[3])=count[0]/note[0])<<"\t20\tcoin(s)"<<endl;
			cout<<"\t"<<(show[4])=count[1]/note[1])<<"\t50\tcoin(s)"<<endl;
			cout<<"\t"<<(show[5])=count[2]/note[2])<<"\t100\tcoin(s)"<<endl;
			cout<<"\t"<<(show[6])=count[3]/note[3])<<"\t500\tcoin(s)"<<endl;
			cout<<"\t"<<(show[7])=count[4]/note[4])<<"\t1000\tcoin(s)"<<endl;
			cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
		}else{
			if(kind == "notes"){
			system("cls");
			cout<<"Enter types of types and amount of notes.( 20 50 100 500 1000)\nex.100 5\n" <<endl;
			cin>>kind>> x;
			if (kind == "20") {bath +=(count[3]) +=(note[0]*x));}
			if (kind == "50") {bath +=(count[4]) +=(note[1]*x));}
			if (kind == "100") {bath +=(count[5]) +=(note[2]*x));}
			if (kind == "500") {bath +=(count[6]) +=(note[3]*x));}
			if (kind == "1000") {bath +=(count[7]) +=(note[4]*x));}
			cout<<endl;
			cout<<"\t"<<(show[0])=count[0]/coin[0])<<"\t1\tcoin(s)"<<endl;
			cout<<"\t"<<(show[1])=count[1]/coin[1])<<"\t5\tcoin(s)"<<endl;
			cout<<"\t"<<(show[2])=count[2]/coin[2])<<"\t10\tcoin(s)"<<endl;
			cout<<"\t"<<(show[3])=count[0]/note[0])<<"\t20\tcoin(s)"<<endl;
			cout<<"\t"<<(show[4])=count[1]/note[1])<<"\t50\tcoin(s)"<<endl;
			cout<<"\t"<<(show[5])=count[2]/note[2])<<"\t100\tcoin(s)"<<endl;
			cout<<"\t"<<(show[6])=count[3]/note[3])<<"\t500\tcoin(s)"<<endl;
			cout<<"\t"<<(show[7])=count[4]/note[4])<<"\t1000\tcoin(s)"<<endl;
			cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
		}else{ if (( kind != "coins")&&(kinds != "notes")) {
		system("cls"); cout << "incorrect type!";}}
    	}
  	}
}