[ error: expected an identifier ]
I am getting the following error using Visual Studio:
41 IntelliSense: expected an identifier
I have no idea what this is trying to say and any help would be appreciated! :D
Here is the program:
#include <stdio.h>
#include <math.h>
int
main(void)
{
long long d;
long long p;
//Ask for numbers of days as long as input is not between 28 and 31
do
{
printf("How may days are in your month?\n");
d = GetInt();
}
while (d<28 || d>31);
//Ask for numbers of pennies for day 1 as long as input is negative
printf("How many pennies do you have");
do
{
p = GetInt();
}
while ("p<0");
//Sum up the pennies, pennies = (pennies*2)*2..*2
int 1;
for (i=0; i<= d-1; i++);
{
p=p*pow(2,i);
}
printf("%lld\n", p);
return 0;
}`
Answer 1
int 1;
for (i=0; i<= d-1; i++);
Here you have int 1;
so the compiler is looking for a variable name such as int x = 1;
Now the for loop, remove that ;
from the end
inside the main
the first two lines you have are
long long d;
long long p;
Here long
is a type, so change those lines to
long d;
long p;
At the end of you file i see }'
, here remove the '
character
In addition, I can see you have while ("p<0");
as the while condition, here "p<0"
is a string, you might want to change it to p<0
.
Answer 2
You also probably want to replace
while ("p<0");
with
while(p<0);
(without the quotes).