-4
#include <stdio.h>
#include <stdlib.h>
int main();
{int dinheiro = 200};
int r$100, r$50, r$20, r$10, r$5, r$2, r$1;
int inter;
while(dinheiro > 0) {
if (dinheiro >= 100) {
r$100 = dinheiro/100;
dinheiro = dinheiro - r$100*100;
}
else{r$100 = 0;}
if((dinheiro >= 50) && (dinheiro < 100)) {
r$50 = dinheiro/50;
dinheiro = dinheiro - r$50*50;
}
else{r$50 = 0;}
if ((dinheiro >= 20) && (dinheiro < 50)) {
r$20 = dinheiro/20;
dinheiro = dinheiro - r$20*20 ;
}
else{r$20 = 0;}
if ((dinheiro >= 10) && (dinheiro < 20)) {
r$10 = dinheiro/10;
dinheiro = dinheiro - r$10*10;
}
else{r$10 = 0;}
if ((dinheiro >= 5) && (dinheiro < 10)) {
r$5 = dinheiro/5;
dinheiro = dinheiro - r$5*5;
}
else{r$5 = 0;}
if ((dinheiro >= 2) && (dinheiro < 10)) {
r$2 = dinheiro/2;
dinheiro = dinheiro - r$2*2;
}
else{r$2 = 0;}
if ((dinheiro >= 1) && (dinheiro < 1)) {
r$1 = dinheiro/1;
dinheiro = dinheiro - r$1*1;
}
else{r$1 = 0;}
printf("notas de r$100 = %d\n", r$100);
printf("notas de r$50 = %d\n", r$50);
printf("notas de r$20 = %d\n", r$20);
printf("notas de r$10 = %d\n", r$10);
printf("notas de r$5 = %d\n", r$5);
printf("notas de r$2 = %d\n", r$2);
printf("notas de r$1 = %d\n", r$1);
return 0;
}
There is no sense in this {} in the money statement. The $ character is not a valid character to use in an identifier. Next time report what error is occurring. The operator = is the assignment operator, it seems to me that you want to check an equality and in this case you should use the ==.
– anonimo
Caro @anonimo the $ there is part of the variable names, in gcc 6.3 it worked normally https://ideone.com/Vck8bN.
– Guilherme Nascimento
From the gcc 9.1 manual: "GCC Allows the ː$' Character in Identifiers as an Extension for Most targets. This is true regardless of the Std= switch, Since this Extension cannot Conflict with standards-conforming Programs. When preprocessing Assembler, However, dollars are not Identifier characters by default. "
– anonimo