This works, but the next step of modifications are giving me some problems.
a) Allow the simulator to perform remainder calculations. This requires an additional Simpletron Machine Language...
Type: Posts; User: jwall
This works, but the next step of modifications are giving me some problems.
a) Allow the simulator to perform remainder calculations. This requires an additional Simpletron Machine Language...
The basic idea of this exercise is to generate words from a user-input, seven-digit number(a phone number). The code runs, but for some reason, I can't get it to print the numbers into the file. ...
Works now. Thanks, but when I try to enter spaces, it messes up the input. Why is that?
Hi:
I am learning about random access files. Everything works, except when I go to read the output from the third program, it gives me a bunch of gobbledegook.
This creates the first random...
rcgldr: That was exactly it--I believe I said that in my previous post :). But I would still like to know how to loop through a file without using feof in this program?
Stack Smashing is actually a protection mechanism used by gcc to detect buffer overflow attacks.
I got the error because some the input was too big for the array. I should have gotten a...
Thanks for the help, but how would I implement
fgets(buf, sizeof(buf), fp) != NULL
in this situation, will it stop the stack smashing error?
BTW I'm on linux
This code does what it is supposed to do, but at the end of the file, I get an error that I have never encountered before. What exactly is stack smashing? I suspect that the files and the...
Any one know some good exercises for pointers to functions?
Here is what I am trying to accomplish:
1) Each hand should be invisible to the user, until a key is pressed or a sentinel value is enter.
2) I need to score each hand and determine which hand...
Already re-wrote it. I can now deal multiple, unique hands. I suppose I can use a loop to deal as many hands as I want or need.
/*Improve shuffling algorithm
*/
#include<stdio.h>...
Now I am going to move on to the next stage of the assignment. I need the program(specifically the function deal) to be able to deal two hands and determine which hand wins. Thanks for the help
#include <stdio.h>#include <stdlib.h>
#include <time.h>
#define CARDS 52
#define SUITS 4
#define FACES 13
#define PAIR 2
#define HAND 5
should I call those two functions in tandem? Do I even need to build a new function at all?
I think I'm half way there with the two and three of a kind function. So I have to modify that if statement to check for two different suits, right?
if(counter[p] == 3 && counter[p] == 2)
...
I have fixed all the errors (namely, that some variables were named as const and could not be modified, but needed to.)
Now I want to know how I can go about determining if a hand is actually a...
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define CARDS 52
#define SUITS 4
#define FACES 13
#define PAIR 2
#define HAND 5
Thanks. Its been a long day.
/*
improve meanmedianmode.c
*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define SIZE 100
double median(int array, int arrayLength);
void mode(int array[], int arrayLength);...
Can someone look over this code and provide constructive criticism? Thanks
/*Make improvements to the bubble sort
*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void...
fixed
//program to fill seats on a train
#include<stdio.h>
#include<stdlib.h>
//function prototype
void bookingProcedure(int whatClass);
int wrongChairInsertion(int whatClass, int chair);
anyone have any idea to make this code a little better? It works, but I'm wondering if there is a way to make it faster and more efficient.
//program to fill seats on a train#include<stdio.h>...
Number of repetitions: 1
Time elapsed: 0 sec.
try won lost
1 0 0
2 0 0
3 0 0
4 1 0
5 0 0
6...
This program works perfectly--except instead of counting to 100000
it stops at some random number. When I try to move the RNG
seed function, it will count up to 100000, but gives the wrong...
It works better now. I was trying to wrap the entire game into a function that I could call from main. I decided that this wasn't necessary, though I would love to know how to do it.
/*A...