View Single Post
Old 03-22-2004, 06:05 PM   #4 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
i think you better get this c++ code running before you try to convert it to c. on my system, it crashes once i enter any response to "Would you like to make a call?[Y/N]".

your compiler is either really smart or really dumb (probably the latter) and is letting you get away with things that shouldn't work.

first and foremost:
Code:
while(Ans1='Y')
i assume you mean the code below (or else your loop never terminates). you will have to make other corrections to make this work right.
Code:
while(Ans1 == 'Y')
you are using scanf incorrectly. you are trying to read a string ("%s") into a char variable (Ans1). this will probably lead to a segment violation (crash), although there are occasions where it will work (it's writing into some memory area that you probably didn't mean to write into). you are also passing it chars instead of char pointers (as well as int pointers).

valmont is right, you are missing "#include <ctype.h>", at least on standard implementations of c/c++.

after these are fixed, it looks to me like your code is already c-compliant and should compile as is.
joe_bruin is offline   Reply With Quote