Could somebody explain to me how to use gets instead of scanf?? And also...how do u use the function atoi? I know you need it to convert strings to integer but there's no specific example in the book.
Well my problem actually concerns arithmetic calculation. (+,- ,*,/) I need to ask the user for input and then show them the result. eg.
input : 12 +3 /5
result : 1
I'm not asking anybody for code, just some ideas on how to go about it.
I had a basic idea about it but it doesnt seem to work. I think you're suppose to store the input into an array, and run through each element of the array, correct?
So, ok I declare something like
char str ;
/* I probably have declare other stuffs as well*/
printf("Enter input"); /* user inputs a string, the somehow i
need to convert it to integers?*/
gets()/* is this how you use gets??*/
/* do the math here */
printf("Result : %d");
I'm sorry if this looks silly but I hope somebody is willing to help. Thanx..