C++ programming
I got a problem here....hopefully got some1 teach me how to solve the problem...here is the question
#include <stdio.h>
#include <cstdlib>
#include <string.h>
int main()
{ float n1 ;
char str1[10],str2[10],str3[10],str4[10];
printf("Enter sentence like ¡°x grams in kilograms ?\n");
scanf("%f %s %s %s %s",&n1,str1,str2,str3,str4);
int strcmp(const char *grams ,const char *kilograms);
if(1 grams = 1*0.001 kilograms);
printf("%f %s = %f %s\n",n1,str1,str2,str3);
system("pause");
return 0;
}
the output needed is :
Enter sentence like “x grams in kilograms ?”: 10 kilograms in grams ?
10 kilograms = 10000 grams.
i donno how to use the strcmp. can any1 teach me ??
>> if(1 grams = 1*0.001 kilograms);
printf("%f %s = %f %s\n",n1,str1,str2,str3);
how to put the 1 grams = 1*0.001 answer to printf ?
i mean 1 grams is 0.001 kg right ? how to put the answer into printf ? cause i never store the answer ...CX
|