automatic taller machine(atm)

can anyone change this program just only use include<stdio.h>...?????


#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<iostream.h>
void main()
{
int choice, a;
float money,m;
clrscr();
void deposite();
void withdraw();
//int func1();


cout<<"Student ID : TATA_12345"<<endl;
cout<<"NAME : RATAN TATA"<<endl;
cout<<"(1) DEPOSITE MONEY"<<endl;
cout<<"(2) WITHDRAW MONEY"<<endl;
cout<<"(3) FIND THE ACCOUNT BALANCE"<<endl;

cout<<"Enter your choice : ";
cin>>choice; /*read the choice*/

switch (choice)
{
case 1:
deposite(); /*to deposite money*/

break;

case 2:
withdraw(); /*to withdraw money*/

break;

case 3: /*to see the balance*/
cout<<endl<<"This facility is not currently available"<<endl;
break;

default: /*if choice is not valid*/

cout<<"ERROR// PLEASE TRY AGAIN";
exit(1);
}
getch();
}

void deposite()
{
float money;
cout<<endl<<"Enter the amount of money to be deposited(dollars.cents):";
cin>>money; /*read the amount to be deposited*/

if(money>0)
{
cout<<endl<<"$"<<money<<" has been deposited in your account"<<endl;
}
else
cout<<endl<<"Please enter valid amount......."<<endl;
}
void withdraw()
{
long int rem,f,t,e;
long int mon;
cout<<"Enter the amount of money to be withdrawn: ";
cin>>mon; /*read the amount to be withdrawn*/

if(mon>=20)
{
if(mon!=30)
{
f=mon/50; /*decides the notes of $50*/
rem=mon%50;
if(rem!=20)
{
if (rem==10||rem==30)
{
f-=1;
rem+=50;
}
}
t=rem/20; /*decides the notes of $20*/
e=rem%20;
if(e==0)
{
cout<<endl<<"Nos. of 50$ note : "<<f;
cout<<endl;
cout<<"Nos. of 20$ note : "<<t<<endl;
cout<<"TOTAL AMOUNT : "<<mon<<endl;
}
else
cout<<endl<<"This amount is not possible... Please try again"<<endl;
}
else /*if amount is not possible*/
{
cout<<endl;
cout<<"This amount is not possible... Please try again"<<endl;
}
}
else
{
cout<<endl;
cout<<"This amount is not possible... Please try again"<<endl;
}
}
You don't need any of these:
1
2
3
#include<stdio.h>
#include<conio.h>
#include<stdlib.h> 


Also, iostream should be: #include <iostream> and you need to add using namespace std;

Your main function should return and int: int main() and should have a return 0; to identify the end of program.
sumbody plz help me.i dont know how to answer this!
------------------------------------------------------------------------------------------------
Before astronauts go up into space, they spend many hours in a spaceship simulator, a physical model of a space vehicle in which they can experience all the things that will happen to them in space. The spaceship simulator is a physical model of another object. A model can be thought of as a series of rules that describe the behaviour of a real-world system. We change the rules and watch the effects of these changes on the behaviour we are observing.
The technique that is used to make the model behave in the same way as the real object is called simulation. We can use similar techniques to build computer models of objects and events rather than physical models.
This project is concerning on building a general purpose simulation program that implements the basic concepts of data structures.

Problem:
Write a general-purpose simulation program that determines how long items (people, jobs, cars, etc.) must wait in line before being served. The program simulates a queuing system, using the following simulation parame¬ters: length of simulation, average time between arrivals, number of servers, and average transaction time.
The simulation must vary the number of servers and the time between arrivals of the items. By using new set of simulation parameters each time the simulation start, the practicality of the simulation to real life scenario is ensured.
You are required to state the program specification (functions, input, output, processing requirements, assumptions, and object oriented design) in your report. Add any figure, screenshot that you consider relevant using C++
@syadz Please create another topic.

Cipok, change all of your couts to prinfs

Here are some example printf statements:
1
2
printf("Hello World!\n");
printf("%d is an integer.", int_var); //%d is integer, %f is float 


Change all of your cins to a combination of fgets and sscanf:

Example to read an integer:
1
2
3
4
5
6
7
// keep a character string for the line
char line[256];

std::fgets(line, sizeof(line), stdin); // Gets a string from the stream

// Gets the number entered and stored into line and store it into number
std::sscanf(line, "%d", &number);


Edit:
Here is the modified code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include<stdio.h>


void deposite();
void withdraw();



char line[256]; // line used for input

int main()
{
	int choice, a;
	float money,m;
		
	printf("Student ID : TATA_12345\n");
	printf("NAME : RATAN TATA\n");
	printf("(1) DEPOSITE MONEY\n");

	printf("(2) WITHDRAW MONEY\n");

	printf("(3) FIND THE ACCOUNT BALANCE\n");
	
	printf("Enter your choice : ");
	fgets(line, sizeof(line), stdin);
	sscanf(line, "%d", &choice);

	
	switch (choice)
	{
		case 1:
			deposite(); /*to deposite money*/

		break;

		case 2:
			withdraw(); /*to withdraw money*/

		break;

		case 3: /*to see the balance*/
			printf("\nThis facility is not currently available\n");
		break;

		default: /*if choice is not valid*/
		
		printf("ERROR// PLEASE TRY AGAIN");
		return 0;		
	}

	printf("Press any key to continue...");
	getchar();
	return 0;
}

void deposite()
{

	float money;
	printf("\nEnter the amount of money to be deposited(dollars.cents):");

	fgets(line, sizeof(line), stdin);
	sscanf(line, "%f", &money);
	

	if(money>0)
	{
		printf("\n$%.2f has been deposited in your account\n", money);
	}
	else
		printf("\nPlease enter valid amount.......\n");
}

void withdraw()
{
	long int rem,f,t,e;
	long int mon;
	
	printf("Enter the amount of money to be withdrawn: ");
	
	fgets(line, sizeof(line), stdin);
	sscanf(line, "%ld", &mon);
	

	if(mon>=20)
	{
		if(mon!=30)
		{
			f=mon/50; /*decides the notes of $50*/
			rem=mon%50;

			if(rem!=20)
			{
				if (rem==10||rem==30)
				{
					f-=1;
					rem+=50;
				}
			}
		
			t=rem/20; /*decides the notes of $20*/
			e=rem%20;

			if(e==0)
			{
	
				printf("\nNos. of 50$ note : %.2ld\n", f);
	
				printf("Nos. of 20$ note : %.2ld\n", t);
				
				printf("TOTAL AMOUNT : %.2ld\n", mon);
			}
			else
			{				
				printf("\nThis amount is not possible... Please try again\n");
			}
		}
		else /*if amount is not possible*/
		{		
		printf("\nThis amount is not possible... Please try again\n");
		}
	}
	else
	{	
	printf("\nThis amount is not possible... Please try again\n");
	}

}

Last edited on
thanks eker..
Topic archived. No new replies allowed.