int main() { /* ねえ、僕はバル・キルマーとの映画に乗り気だったのに */ float val; printf("品目の値段:"); while(scanf("%f",&val) == 1){ printf("ここまでの合計:%.2f\n",add_with_tax(val)); printf("品目の値段:"); } printf("\n最終合計:%.2f\n",total); printf("品目数:%hi\n",count); return 0; }
int main() { float val; printf("Price of item: "); while (scanf("%f", &val) == 1) { printf("Total so far: %.2f\n", add_with_tax(val)); printf("Price of item: "); } printf("\nFinal total: %.2f\n", total); printf("Number of items: %hi\n", count); return 0; }
int main() { /* Hey - I was up for a movie with Vek Kilmer */ float val; printf("Price of item: "); while ( scanf("%f", &val) == 1 ) { printf("Total so far: %.2f\n", add_with_tax(val)); printf("Price of item: "); } printf("\nFinal total: %.2f\n", total); printf("Number of items: %hi\n", count); return 0; }
int main(int argc, char* args[]) { float val; int i; printf("Price of item: "); for (i = 0; i < argc; i++) { printf("Total so far: %.2f\n", add_with_tax(atof(args[i]))); printf("Price of item: "); } //少数点以下2桁まで printf("\nFinal total: %.2f\n", total); //hiはshort用 printf("Number of items: %hi\n", count); return 0; }