Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
Veröffentlicht von:Shanon Sharleen Ramsey Geändert vor über 5 Jahren
1
Arguments to main() int main(int argc, char *argv[]) { int i;
printf("argc = %d\n",argc); for (i=0; i<argc; i++) printf("argv[%d] = %s\n",i,argv[i]); return 0; }
2
Arguments to main() fox01> ./myprog this is apple argc = 4
argv[0] = ./myprog argv[1] = this argv[2] = is argv[3] = apple
3
Fahrenheit to Celcius #include <stdio.h>
#include <stdlib.h> int main(int argc, char *argv[]) { double fahrenheit, celcius; fahrenheit = atof(argv[1]); celcius = (fahrenheit-32)*5.0/9; printf("Celcius = %f\n",celcius); }
4
Arguments to main() fox01> ./fahtocelcius 36 Celcius =
5
Fahrenheit to Celcius #include <stdio.h>
#include <stdlib.h> int main() { double fahrenheit, celcius; printf("Enter fahrenheit"); scanf("%lf",&fahrenheit); celcius = (fahrenheit-32)*5.0/9; printf("Celcius = %f\n",celcius); }
6
Arguments to main() fox01> ./fahtocelcius2 < f.txt
Enter fahrenheitCelcius = f.txt file has the following 34
Ähnliche Präsentationen
© 2024 SlidePlayer.org Inc.
All rights reserved.