C :: ATM Program - Withdraw And Fastcash Functions Are Not Working
Apr 19, 2013
My ATM program compiles but my withdraw and fastcash functions are not working right in my program.
Here is my program:
Code:
#include<stdio.h>
#include<stdlib.h>
int fn_balance(int *);
void fn_deposit(int *);
void fn_withdraw(int *);
void printReceipt(int *);
void mainMenu(int *);
void FastCashMenu(int *);
[Code] .....
View 1 Replies
ADVERTISEMENT
Nov 22, 2014
The switch statement is giving me trouble. Worked fine in the main, but when I had to put it in separate functions per my professor, I had several issues. I guessing I am not calling the function correctly. Our group worked on it but could not find a solution to fix the switch statement.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <conio.h>
using namespace std;
//function prototypes
int menu(); //function to show main menu
void Seating_Chart(); //function to show seating chart
[Code] ....
View 2 Replies
View Related
Oct 16, 2013
I've been working on a battle simulator, and using it as a learning experience. So far, I've been able to debug the program, and learn some stuff, and it's been running smoothly. It's still runnable, but I've been trying to make it so the player can save his character, and continue the game later. However, I'm not sure whether it's the save or load function that's not working, because even if i save to a txt file, it's just a bunch of random characters. I don't know if that means it's not saving correctly, or if it's just supposed to be like that. Anyway, here are the two functions I'm speaking of:
Code:
void Game::saveGame(Character &player) {
std::ofstream saveFile("save.bin", ios::binary);
saveFile.write((char *)&player, sizeof(player));
saveFile.close();
[Code] .....
My program is in multiple files, so I can't really post the whole code easily, but I can upload or something if I really need to.
View 14 Replies
View Related
Feb 3, 2015
I'm a bit stuck on a program that prints out a 8x8 chessboard and Q to represent queens where the user enters input. The intended output is: Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7
Q.......
...Q....
....Q...
Q.......
Q.......
.......Q
......Q.
.......Q
but instead I get Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7
.Q
.Q
.Q
.Q
.Q
.Q
[code].....
View 2 Replies
View Related
Nov 8, 2013
I am relatively new to C programming, and I am encountering numerous issues with this program that I cant seem to figure out how to fix.
First, when the user selects the arithmetic game, I keep on getting different incorrect answers from the arithgame function. For example, when I am presented with the question 3+2=_, sometimes the function claims the answer is the first number, 3, and other times the function gives me a multiplication answer, 6. This happens in both the addition and multiplication parts (ie. the multiplication answer will either be the first number or the addition answer).
Additionally, I cant figure out why my guessing game loops forever, rather than letting me guess until I get a correct answer.
View 2 Replies
View Related
Mar 27, 2013
I would like to modify attributes like modification/creation dates.The function is correctly working as if I type in "ls -al", the timestamp is correct. But when using my program to read these attributes, it returns the "real" modification/creation date. Here is the function that shows the timestamp :
Code:
time_t t = sb.st_mtime; struct tm tm = *localtime (&t);
char s[32];
strftime (s, sizeof s, "%d/%m/%Y %H:%M:%S", &tm);
printf ("%-14s %s", lecture->d_name, s); And here is the code for modifying the timestamps : Code: void modifyAttributes(char * file, int mtime, int atime)
}
[code]....
View 9 Replies
View Related
Jan 12, 2013
int main() {
int vnum = 0;
VEHICLE *vehiptr;
VEHICLE *dptr;
cout<<"Please enter the number of vehicle: ";
cin>>vnum;
vehiptr = new VEHICLE[vnum];
[Code] .....
View 9 Replies
View Related
May 20, 2013
Why is my program outputting zero for the variable pop?
Code:
#include <iostream>
int main(void){
using namespace std;
//capture data
cout << "Enter the world's population: ";
[Code] ....
It's obviously not std::cout, but I'm thinking its the way I'm operating on long?
View 5 Replies
View Related
Jan 26, 2015
This program works on an online compiler but force closes on codeblocks after entering the elements.
#include<iostream>
using namespace std;
int two_print(int x, int one[999]) {
int two[999][999];
for(int k=0, r=x; k<=x; k++, r--)
[code]....
View 6 Replies
View Related
Feb 22, 2013
I'm having troubles with this program I made. Put it simply, it's a basic program using Queues. Whenever I try to input a value, my compiler(Dev C) suddenly stops working. The .exe file crashes and I've no way on how I can execute my program.
Code :
#include<iostream>
using namespace std;
int *queue;
int rear, front, queueSize;
void enqueue();
void dequeue();
void display();
[Code] ....
View 1 Replies
View Related
Aug 8, 2013
I'm not sure what I'm missing. It is supposed to input and display player's name and score, calculate the average score, and display the players who scored below average.
It simply doesn't work. All I get is a black screen. Debug spits out an exit code of 1073741510 (0xc000013a).
Code:
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
const int arSize = 100;
int inputPlayerData (string playerName [], int playerScore [], int &numPlayers);
[Code] ....
View 6 Replies
View Related
Mar 30, 2014
I'm trying to write a C++ program that will allow a user to input a number from the keyboard. Then using a loop, that will perform 10 times, multiply the entered number by the loop counter. Print out the loop counter, the entered number and the product of the loop counter and the entered number. A one-time heading should be displayed before information is printed.
This kinda of what I have so far:
#include <iosteam>
using namespace std;
int main () {
Start
Declare: numScores, sum, score, avg, SENTINEL = 200
numScores = 0
[Code] ....
All the programs I have tried to make are not working?
View 4 Replies
View Related
May 9, 2013
I tested my count funtion. So my count function is not working properly, it should return 5 because 5 words have prefix "tal," but it is giving me 10. It's counting blank nodes.
This is my main.cpp file
int main() {
string word;
cout<<"Enter a word"<<endl;
cin >> word;
string filename;
[Code] .....
View 9 Replies
View Related
Dec 12, 2013
Here your supposed to create a program that takes in information and formats it into three columns.
I can't seem to use the float variable unitprice with decimal places here for, if I try to use %.1f and type in an input, the program seems to skip over the second scanf function, not allowing me to put input into the third scanf function as the program runs before I can.
I can use %f on its own and it works but this creates too many zeroes(and you're supposed to set the currency limit to $99999.99).
Code:
#include <stdio.h>
int main(void) {
int itemno, month, year, day;
float unitprice;
[Code]....
So the output should look like three columns. It's just the float that is the issue here....
View 5 Replies
View Related
Feb 11, 2015
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
class Player {
private:
char name[20];
int score;
[Code] .....
View 5 Replies
View Related
Sep 28, 2014
I was given a task to convert infix to post fix using both linked lists and stacks in the code so this is what i have written but the problem is it is giving me same error at three different places "missing function header(old style format?)
#include <iostream>
#include <string>
using namespace std;
const int size = 100;
class stack{
private: // Declare a structure for the list
[Code] ....
View 12 Replies
View Related
Jan 22, 2013
I am getting an error on lines 31 and 36 about an expected identifier on my program that computes area and circumference. Is something wrong with my external functions outside of main?
Code:
#include <stdio.h>
#define PI 3.14159
double area;
double circum;
double find_circum (double radius);
double find_area (double radius);
[Code] ....
View 2 Replies
View Related
Apr 6, 2013
I am looking at functions still and can't see the point in declaring the function at the top of the program, and then defining later i.e.
Code:
#include <iostream>
int add (int x, int y) {
return x + y;
[Code] .....
I obviously don't have much real world experience with this and am interested to see where declaring and defining later would be useful and/or beneficial.
View 14 Replies
View Related
Jun 16, 2013
Is there a program that can remove the functions in a program by preprocessing
Code:
#include<stdio.h>
int is_even(int number);
int main(void)
{
if(is_even(number))
{
printf("%d is even", number);
}
}
[Code]...
To something like
Code:
#include<stdio.h>
int is_even(int number);
int main(void)
{
if( number%2 ==0 )
{
printf("%d is even", number);
}
}
I use the "-E" option when compiling with gcc on linux but its output still contains funcitons. Is there a preprocessing program that can remove functions from a program?
View 6 Replies
View Related
Feb 26, 2013
when i am running this program no errors are being shown but as soon as i press ctr+f9 to run the program my tc++ window closes.....
Code:
#include<stdio.h>
#include<conio.h>
void multiply(int m1[50][50],int ,int,int m2[50][50],int ,int );
void main() {
int i,j,m,n,p,q,m1[50][50],m2[50][50];
[Code] ....
View 4 Replies
View Related
Nov 15, 2014
I have to make a numerical integration program, how I can write my code so that the user is able to write their own function that they want to integrate?
E.g. they would see the message: 'please enter your function' and would be able to write whatever they wanted e.g. 'x +5' then this would then be integrated by the program.
I have already written a program that can integrate a known function but would prefer that the user could choose their own.
View 2 Replies
View Related
Apr 12, 2013
I'm writing a program to check whether codes from a file are invalid, valid, inactive, or valid and active, but can't get it to work properly. The invalid codes are being found, but the other three are not. I think it may have something to do with my "active" function.
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
using namespace std;
struct ActiveCodes {
string code;
bool flag;
[Code] ....
View 19 Replies
View Related
Mar 24, 2013
We have been assigned to create a program that uses multiple functions. The professor has given us code for two of the functions, one to open a file and then another one to read the files contents and output them. I have put these into my program but they will not execute. The program does run, but the functions themselves are not executing. I have practiced with other functions that contain no parameters and those run fine, but the functions she gave us have multiple parameters.
The code I have so far is below:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
void PrintFile (string FileName, ifstream& inFile);
int main () {
ifstream inFile;
string fileName;
[Code] .....
View 1 Replies
View Related
Apr 24, 2013
I'm working on a parallel Fortran program by using MPI, which calls a very good random number generator function from C (drand48 and srand48 for seed).
My Fortran program file "Par_PICFort_4.f95" is smt. like:
Code: PROGRAM main
IMPLICIT NONE
Include 'mpif.h'
[Code]....
I compile the code as: Code: mpif77 -o PIC Par_PICFort_4.f95 drand48.c Program seem to be running, but after checking the simulation results, I see that drand48 is not working in a parallel way. Creating independent random numbers which different seeds is very important for me.
Question: Is it possible to run the drand48.c file as parallel?
View 2 Replies
View Related
Oct 25, 2013
So i have to use these prototype functions to run loops and to pause the program, the only problem is after i select a loop option and enter a number of dots to print in the loop it goes into an infinite loop and why, also when i try using the 4 option to exit it still asks me how many dots i want to print.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int pause(char *);
int getInt(char *);
void whileFunction(int);
void doWhileFunction(int);
void forFunction(int);
[Code] .....
View 12 Replies
View Related
Mar 14, 2013
Write a program with two functions both called from main(). The first function just prints "Hello". In the second function ask the user to enter a number. Calculate the square root of the number and return the result to main(). In main() print the square root value.
Code:
#include<stdio.h>
#include<math.h>
float fun3 (float );
main()
}
[code]...
View 3 Replies
View Related