Also das mit -std=c99 scheint nur zu funktionieren wenn ich es im Projekt unter den Optionen festlege. Wenn ich es aber so in den Text reinschreibe funktioniert es nicht. Also ich werd aus den Dingern nicht schlau xD
Nungut, es lag an den () für int nun aber wieder weitere Fehler

:
In function 'main':
32 error: expected ';' before '}' token
=== Build finished: 1 errors, 0 warnings ===
aber da ist doch alles richtig O.o
PHP-Code:
// Getränkeautomat
#include <stdio.h>
#include <stdlib.h>
int main() {
//Getränkeliste
printf("\n Our drinks:");
printf("\n--------------------------");
printf("\n1) Coca Cola 1.85$");
printf("\n2) Ice Tea 1.45$");
printf("\n3) Water 1.20$");
//Getränkeauswahl
int choice;
double costs, payed, payed2;
double dollars[12] = {0.01, 0.05, 0.10, 0.25, 0.50, 1, //Münzen
2, 5, 10, 20, 50, 100} ; //Scheine, keine 1$ Note
printf("\n\n\nPlease choose your drink: ");
scanf("%d", &choice);
switch (choice) {
case 1:
costs = 1.85;
printf("\nYou choose Coca Cola. Please insert 1.85$: ");
break;
case 2:
costs = 1.45;
LINE 32 printf("\nYou choose Ice Tea. Please insert 1.45$: ");
break;
case 3:
costs = 1.20;
printf("\nYou choose Water. Please insert 1.20$: ");
break;
default:
printf("\nYou choose nothing. See you!");
exit(0);
}
scanf("%lf", &payed);
while (payed < costs) {
printf("Please insert more money (%2.2lf$ left): ", costs - payed);
scanf("%lf", &payed2);
payed += payed2;
}
printf("\nYou insert: %2.2lf\nYour change: %.2lf\n", payed, payed - costs);
if (payed > costs) {
printf("Take: \n");
payed -= costs; //in payed steht ab jetzt nur noch das verbleibende Wechselgeld
for (int i = 11; i >= 0; i--) {
if (payed >= dollars[i]) {
printf("%d x %10.02lf$\n", (int)(payed / dollars[i]), dollars[i]);
payed -= (int)(payed / dollars[i]) * dollars[i];
}
}
}
return 0;
}