Registered: Oct 2002
Location: TX TA #3 5p4c3 C!ty
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??
___________________
You ain't no daisy, no daisy at all
Jan-30-2003 06:42
tranceaholic
chus & Ceballos addict
Registered: Mar 2002
Location: behind the decks
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
Jan-30-2003 07:24
halo
...
Registered: Jul 2002
Location: GTA #303 ;P
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.
___________________
DISCLAIMER:
The above text is believed to be derived from objective logic. No personal offence, implicit or explicit, is intended. Ambiguous expressions are to be interpreted in the less offensive way.
Jan-30-2003 16:40
Kirby
Supreme tranceaddict
Registered: Mar 2002
Location: Middletown, CT or Durham, NH
Just curious, what is your assignment?
Jan-31-2003 01:23
digitalbreach
the sky is falling
Registered: Oct 2002
Location: TX TA #3 5p4c3 C!ty
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
___________________
You ain't no daisy, no daisy at all
Jan-31-2003 05:22
drizzt81
Professional Lamer
Registered: Nov 2001
Location: GTA #1 - At work
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);
I see your 4 Crushs and raise you 3 As The Rush Comes. - Yan from PvD's first summerstage event in '03
Jan-31-2003 08:15
digitalbreach
the sky is falling
Registered: Oct 2002
Location: TX TA #3 5p4c3 C!ty
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
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
I see your 4 Crushs and raise you 3 As The Rush Comes. - Yan from PvD's first summerstage event in '03
Feb-01-2003 02:43
digitalbreach
the sky is falling
Registered: Oct 2002
Location: TX TA #3 5p4c3 C!ty
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??????
___________________
You ain't no daisy, no daisy at all
Feb-01-2003 22:58
drizzt81
Professional Lamer
Registered: Nov 2001
Location: GTA #1 - At work
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