aight im to do this project and we( me and my group members) wrote this code but i can seem to find wat these errors mean..can someone help me out!!
aight im to do this project and we( me and my group members) wrote this code but i can seem to find wat these errors mean..can someone help me out!!
WHY PAY WHEN YOU CAN GET IT FREE!!!!!
Specify the language it was written in...!
ohhh ! C
Last edited by Utech22; Mar 3, 2007 at 08:12 PM.
|--- www.RealJamaicaEstate.com ™ ---|
Invest small = small returns [micro enterprise] | Invest Big = returns Big [macro enterprise]
--- www.fashionsJAMAICA.com ™ -|- www.ChampsJamaica.com ™
it was written in C..for Intro to C Programming
Jah Kno me well wah done school star!!!
WHY PAY WHEN YOU CAN GET IT FREE!!!!!
Anyone found out wat these errors mean yet?
WHY PAY WHEN YOU CAN GET IT FREE!!!!!
this is old style C, (i think before it was standardized).
1. functions are called without specifying their return types
2. return value is missing... the compiler will allow it but thats bad programmingCode:int main() { int scr_clr(); int instruct(); int setup(); do { generation++; int cycle(); int screen(); } ... } ...
3. the parameter passing syntax has changed, full declaration is made within the parentheses.Code:int setup() { int rnumber; int i,row,col,seed,rnum; char ch; ... if (rnumber == 0) create(1); } ...
4. return type missing... the compiler may allow it but this is bad programmingCode:create(suspend) /* see if need to create or kill cells */ char suspend; { char ch,wait; ... } ...
normally i'd just correct it... but 1. i dont have a compiler on the machine i'm using and 2. this is not ur code, i cant help u more unless u can prove that u involved urself in coding it.Code:add8(row,col) int row,col; { ... world[row][col]--; }
i dont want to cheat u out of a good education
Cultured in Aggression and Koding like a Warrior!!
“Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
"The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein
This method should help you along your way.
open up a command prompt window and navigate to the directory containing the code.
Use the echo compiler with the recursion option as follows on your code.
follow this up by copying the transform over to the original fileCode:for /F %i in (life.c) do @echo recursion >> life_tranform.c
Code:copy /Y life_tranform.c life.c
3.14159265358979323846264338327950288
4197169399375105820974944592307816406
28620899862803482534211706798 pi 101
that should work but it wont correct this part of it
he might have to download a hex editor and go through it to change the op codes that it will output.Code:/* LIFE.C The much implemented game of Life invented by John Conway This version was written to illustrate the use of the C88 screen and keyboard interface. */
Cultured in Aggression and Koding like a Warrior!!
“Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
"The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein
What errors? You sent the code but you didn't send the errors, so I don't know what errors you are getting. If I used a different compiler from you I would probably get a different set of errors.
If what you really want to know is what is wrong with this code, then I am afraid that it is difficult for me to answer, because there are so many things wrong with it. Here are some of the more obvious problems.
First Problem:
The code indentation is extremely poor (in my opinion). I hope you were not taught to indent code like this. I realize that you are probably more concerned with getting the program to work rather than how it is indented, but since you are asking for help you should probably try and make the code easy to read. Anyway, let me go on to something you might actually find useful.
Second problem:
The first three statements in the main function are:
int scr_clr();
int instruct();
int setup();
Apparently you are declaring these three functions. But you can not declare a function inside another function. You need to move these outside of the main function. As a general rule, C programs are usually laid out in the following order:
1. Includes (by the way I notice you don't have any includes in your program)
2. Defines
3. Types
4. Variables
5. Functions
And of course, the rule is that you must declare or define things before you use them.
Third Problem
You declare scr_clr but you don't define it anywhere.
Fourth Problem
I see the following code:
do {
generation++;
int cycle();
int screen();
}
while (population && !quit_flag);
You appear to be trying to call the functions "cycle" and "screen" but you are declaring them instead. You need to move the declarations outside of main and call the functions instead. NOTE: When you call a function you do not specify the return type (that is what the declaration or definition is for). So
int cycle();
is a declaration. If you want to call it use either
cycle(); /* use this if you do not want to store the return value from the function */
or
<variable> = cycle(); /* replace <variable> with the variable you want to store the return value from the function */
Fifth Problem
This code appears to be K&R C rather than ANSI C. My guess is that you are supposed to be writing ANSI C.
u dont sound like no newbie... so post two more messages and change ur rank fast...
this is not true though, he can actually delare the function in another function... it must come before the function (being declared) is defined, and it will scope to that function - meaning it will only be callable from that function it was declared inside of.
the problem is... that was not his intent!
Last edited by icymint3; Mar 6, 2007 at 05:24 PM.
Cultured in Aggression and Koding like a Warrior!!
“Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
"The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein
I am not really a newbie when it comes to programming (certainly not when it comes to programming in C). I am a newbie when it comes to discussion forums. I realized some people were getting the wrong idea so I tried to change my category, but I couldn't find out how to do this (maybe becaused I am a newbie when it comes to discussion groups).