Forum: C Mar 11th, 2007 |
| Replies: 49 Views: 10,360 Excellent! That works, thanks everyone 2d arrays are my new best friends :) |
Forum: C Mar 10th, 2007 |
| Replies: 49 Views: 10,360 nope,now I'm seeing 17 and sometimes 20 |
Forum: C Mar 9th, 2007 |
| Replies: 49 Views: 10,360 That works! But is there a way I can ensure that the 20 locations always get filled? It seems to only get around 18 |
Forum: C Mar 9th, 2007 |
| Replies: 49 Views: 10,360 The max_total is 20 I initially had a while loop to ensure that 20 positions got filled but once it didn't work i took it out.
while(count<=max_total){
for (int i=0;i<max_total;i++) {... |
Forum: C Mar 9th, 2007 |
| Replies: 49 Views: 10,360 Yeah, so its running now after i made some changes.
float game(const int array3[][col], int row_size, int col_size,int max_location)
{
int attempts=0;
int rowLoc;
int colLoc;
int... |
Forum: C Mar 8th, 2007 |
| Replies: 49 Views: 10,360 nope, I declared i and j before as suggested and now the error sits on the initializer line. I was wondering how I could search just the user provided location instead of going through the whole... |
Forum: C Mar 8th, 2007 |
| Replies: 49 Views: 10,360 ok I have no idea what is going on so I'll post the entire fuction NB. the function is supposed to return the user score based on attempts and found locations
float game(const int yard[][col],... |
Forum: C Mar 7th, 2007 |
| Replies: 49 Views: 10,360 I got a more than a little errors most of them say something like
error C2143: syntax error : missing ';' before 'type'
I wonder if this is because The function is located in a separate C file |
Forum: C Mar 6th, 2007 |
| Replies: 49 Views: 10,360 Oh thanks i understand thats why I edited the post but i was asking something else but I guess you had already seen the first post.I'll repost so you'll know what I'm talking about.
If I had to... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,360 Thanks a bundle one last thing say I had to guess at a location and i guessed at the row and column how would i check that specific row and column to see if it contained the id? Here what i came up... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,360 Thanks, can I also ask and why is it necessary to use the time function along with rand()? and using LamaBot's method don't I wanna check it the location is equal to zero using something like
... |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,360 oh, and why are we defining elements to 100? |
Forum: C Mar 5th, 2007 |
| Replies: 49 Views: 10,360 Thanks for the help, First of it hast to be a multi-d array since the rows and columns are predefined.
Second what is wrong with my attempt at initialization to zeros?
byard[row][col] =... |
Forum: C Mar 4th, 2007 |
| Replies: 49 Views: 10,360 ok maybe I didn't explain this right the array has a fixed amount of rows and columns. I am supposed to randomly populate the array with 12 objects
I wanted to identify the objects with a number... |
Forum: C Mar 4th, 2007 |
| Replies: 49 Views: 10,360 I need a function that will populate a multidimensional array with a fixed amount of elements. So that only some of the locations contain a distinguishing number for identification. |
Forum: C Feb 21st, 2007 |
| Replies: 11 Views: 2,930 Heres the code I know the indention is terrible but hopefully u would understand:
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<math.h>
/*Function Prototypes*/ |
Forum: C Feb 21st, 2007 |
| Replies: 11 Views: 2,930 I've built and rebuilt several times the variables are all integers
here is my updated function:
int rounds(int,int);/*Prototype*/
score1=rounds(ranNum,guess1);/*Call rounds function*/
... |
Forum: C Feb 21st, 2007 |
| Replies: 11 Views: 2,930 /*function prototype*/
void rounds(int,int);
rounds(ranNum,guess1);/*Call rounds function*/
The error is on the function call line.Can the same function return the score to main to determine... |
Forum: C Feb 21st, 2007 |
| Replies: 11 Views: 2,930 I changed the variable to random and I'm still getting the error |
Forum: C Feb 21st, 2007 |
| Replies: 11 Views: 2,930 I have a function called rounds that that carries out a round for a two player guessing game the score is calculated based on the time taken and the attempts used
void rounds(int rand, int... |
Forum: C Feb 20th, 2007 |
| Replies: 31 Views: 5,762 So I'm supposed to expand on this game and make it two player. I have modularised and I started on a rounds function that will take in each players' guess and the random number and carry out a round.... |
Forum: C Feb 18th, 2007 |
| Replies: 31 Views: 5,762 One last thing, how would i display a cumulative score at the end of all of the rounds? |
Forum: C Feb 17th, 2007 |
| Replies: 31 Views: 5,762 The formula for the score was given as
score = 5 * (total amount of attempts allowed - actual amount of attempts taken)
where the total amount allowed is 5 so if i guess right on the first try... |
Forum: C Feb 16th, 2007 |
| Replies: 31 Views: 5,762 Ok, so I should have mentioned that the random function was provided so I can't change it so were the condition for the messages. I added the score after the inner while loop and it works like a... |
Forum: C Feb 15th, 2007 |
| Replies: 31 Views: 5,762 #include <stdio.h>
#include <stdlib.h>
/*Funtion Prototypes*/
int genRandom(void);
int main(void)
{
/*Declare variables*/ |
Forum: C Feb 13th, 2007 |
| Replies: 31 Views: 5,762 Thanks a bundle. It works now except when I'm correct I can't break out of the loop and print the score, also It isn't starting another round after the failed attempts. |
Forum: C Feb 13th, 2007 |
| Replies: 31 Views: 5,762 here is the revised code
#include <stdio.h>
#include <stdlib.h>
/*Funtion Prototypes*/
int genRandom(void);
int main(void) |
Forum: C Feb 13th, 2007 |
| Replies: 31 Views: 5,762 I been trying to work on my indentation and I thought I was getting better can you suggest a good code editor that would help?
Thanks. |
Forum: C Feb 12th, 2007 |
| Replies: 31 Views: 5,762 I have this program to write thats a guessing game. the user specifies the amount of rounds and only 5 attempts per round is allowed a round is over when the user guesses correctly or the number of... |
Forum: C Nov 19th, 2006 |
| Replies: 8 Views: 1,936 I already have about eight or so functions the results are supposed to be printed to to a logfile and to screen but I took out the commands to make it simpler when you say unreachable what do you... |
Forum: C Nov 19th, 2006 |
| Replies: 8 Views: 1,936 I thought I was finished with this program but now I can’t find a way to make it quit. The loop continues even when I enter the terminating character. I’ll post he whole thing. The answer may be... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 i am expecting a character count of the longest line using a variable text file I created a txt file to test on about nine lines long and the logest line is about 23 characters but currently i'm... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 thanks, I didn't see the point in posting the entire code either but I was trying to be cooperative, originally the file was to be opened in main so the filename would be variable. Longest() was to... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 entire code
/*Funtion Prototypes*/
int averagechar(int,int);
int longest(void);
int shortest(void);
int words(FILE *);/*funtions I have written but I won't include them here*/
int... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 Ok, tried this
int longest(void)
{
char line[BUFSIZE] = {'\0'} ;
int counter=0;
int longest=0;
char fname[128];
FILE *file; |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 Well I guess I should just toss in my hat and quit then, i'm kinda new at this and I did use the tutorial given as my guide and this what I gathered from it if its wrong then i'm sorry but at least... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 btw I'm a she...:o I tried changing the !=0 to NULL, I tried incooperating the if (counter<longest) within the while braces but longest is still returning zilch. So I took out fgets(since I thought... |
Forum: C Nov 17th, 2006 |
| Replies: 34 Views: 6,204 I am opening the file in main now my value for longest is always zero. I am using separate functions one for the longest and another for the shortest
/*Funtion Prototypes*/
int... |
Forum: C Nov 16th, 2006 |
| Replies: 34 Views: 6,204 I'm trying to use fgets but it isn't proving very easy and of course it doen't complile
/*longest() takes in a file stream and finds the longest line*/
int longest(FILE *file)
{
char... |
Forum: C Nov 16th, 2006 |
| Replies: 34 Views: 6,204 How do I use fgets if I am not sure of the maximum line size?
while (fgets(line, LINE_MAX, file) != EOF) |