19 lines
371 B
C
19 lines
371 B
C
#include<stdio.h>
|
|
#include<stdlib.h>
|
|
#include<string.h>
|
|
|
|
int main(int argc, char * argv[]){
|
|
char* temp;
|
|
char* type;
|
|
double valeur;
|
|
type = argv[2];
|
|
valeur = strtod(argv[1],&temp);
|
|
double conversion = 2.54;
|
|
if (strcmp(type,"cm")==0){
|
|
printf("%.2lf in\n",valeur / conversion);
|
|
}
|
|
if (strcmp(type,"in")==0){
|
|
printf("%.2lf cm\n",valeur * conversion);
|
|
}
|
|
return EXIT_SUCCESS;
|
|
} |