TranceAddict Forums

TranceAddict Forums (www.tranceaddict.com/forums)
- Chill Out Room
-- C programming inquiry


Posted by digitalbreach on Jan-30-2003 06:42:

C programming inquiry

this goes out to all with C experience. kinda pulling my hair over this program. have a question for all of u?


lets say I have "if ( ) else ( )"
can I have a while loop in the "if" and a do-while loop in the else part of my program. ???
thanx. is it valid?? kinda of a beginner??


Posted by tranceaholic on Jan-30-2003 07:24:

u dont need the if else just use couple of loops cause if the condition fails in the first one it will go to the seconf one..that is if u got ur question right ot u van include if within the while


Posted by halo on Jan-30-2003 16:40:

first off the structure is:

if ()
{}
else
{};

so you have a block of code for your condition and one for any other case. The else block is like any other block of code. So basically: yes, you can.


Posted by Kirby on Jan-31-2003 01:23:

Just curious, what is your assignment?


Posted by digitalbreach on Jan-31-2003 05:22:

Hello!

thanX
c is a pain. kinda have to get used to it. It helps when I print out my script file and got through the steps in my head.

well guys....I might have to call upon u again so don't go nowhere



Posted by drizzt81 on Jan-31-2003 08:15:

Re: C programming inquiry

quote:
Originally posted by digitalbreach
this goes out to all with C experience. kinda pulling my hair over this program. have a question for all of u?


lets say I have "if ( ) else ( )"
can I have a while loop in the "if" and a do-while loop in the else part of my program. ???
thanx. is it valid?? kinda of a beginner??


yes u can:

code:
do { some code... if(a >1) { while(c<3) { printf(c); c = c + 1; } } else { printf("hello world/n"); } a++ }while(a < 4);


Posted by digitalbreach on Feb-01-2003 01:39:

Hello!

just cuz i forgot
if I finished my "blah.c" file and i also have an input file "blah.dat"(bare w/ me)
how do I test it in Unix system
using the unix compiler cc
thanx


Posted by Stanza on Feb-01-2003 02:29:

For your reference check out this book C Programming Language Second Edition

It's considered as the C bible


Posted by drizzt81 on Feb-01-2003 02:43:

quote:
Originally posted by digitalbreach
just cuz i forgot
if I finished my "blah.c" file and i also have an input file "blah.dat"(bare w/ me)
how do I test it in Unix system
using the unix compiler cc
thanx

assumig: the .dat file is read within your program

put both in a nice dir

then look http://helpme.scudc.scu.edu/compilers.html <

u want to pay attention to this line:

cc prog1.c -o prog1


Posted by digitalbreach on Feb-01-2003 22:58:

Question

well I loaded my "blah.dat" file (contains the input needed for program to execute)
also loaded "blah.c" file into Unix using the ftp and put command
next I telnet into unix. I ftp'd it as and anscii file type. supposed to.
so I try to compile my "blah.c" file using cc and given parameters but it gives me errors.
prints out gibberish(guessing it supposed to do that) than it says:"
ld:
Unresolved:
acos
fabs
pow
sqrt

assuming it can't process those commands which are inside my "blah.c" file. probably need to input some sort of math directory??? helppppp??????


Posted by drizzt81 on Feb-02-2003 09:18:

quote:
Originally posted by digitalbreach
than it says:"
ld:
Unresolved:
acos
fabs
pow
sqrt

assuming it can't process those commands which are inside my "blah.c" file. probably need to input some sort of math directory??? helppppp??????


try adding

#include to the top of your source code, then ftp and compile again.. see what happens. That _should_ take care of swrt, pow, acos.. i do not know what fabs does though


Posted by daydreamer on Feb-03-2003 04:11:

had already done that, in the beginning of my program.
any other suggestions. oh..fyi: fabs (absolute value for floats)


Posted by drizzt81 on Feb-04-2003 01:40:

quote:
Originally posted by daydreamer
had already done that, in the beginning of my program.
any other suggestions. oh..fyi: fabs (absolute value for floats)


see if your PATH includes the directory, where the lib's are stored


Posted by digitalbreach on Feb-04-2003 20:49:

haha... i was just typing up the command incorrectly....the whole fucking time!!!
well thanx for all ya's help. thanx dritz

works like a charm now!!! woot


Posted by drizzt81 on Feb-04-2003 23:38:

ok here's a question:

why does digitalbreach ask a question.

I answer and then daydreamer tell me that he had already done that as if he had written the same program as digitalbreach???


Posted by digitalbreach on Feb-06-2003 20:04:

Confused

whatever do u mean???

Now that's a riddle within itself


well my good lad...
i was replying to your post and my gay brother forgot to log out. so I posted under his profile. thanx again.


Posted by digitalbreach on Feb-06-2003 20:04:

Confused

whatever do u mean???

Now that's a riddle within itself


well my good lad...
i was replying to your post and my gay brother forgot to log out. so I posted under his profile. thanx again.

question what is your favorite compiler to use???
using Visual C++ so far...its ok



Powered by: vBulletin
Copyright © 2000-2021, Jelsoft Enterprises Ltd.