Hey peoples im new to macros and i have seem to have gotten the notation for my VOLUME macro, however i dont know what to do for the PRINTSTR macro which is supposed to ask a string for you to input which will then be outputted onto the next line.
Code:#include <stdlib.h> #include <stdio.h> int main() { #define VOLUME(r) ((4.0 /3) * 3.14 * (r)*(r)*(r)) #define PRINTSTR(str) printf("%s") char str[100]; float r; printf("Please enter the radius of a sphere \n"); scanf("%f", &r); printf("The volume of the sphere is: %.2f\n", VOLUME(r)); printf("Enter a string you want to print \n"); scanf("%s", str); PRINTSTR(str); return 0; }



LinkBack URL
About LinkBacks


