Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
For some reason, my "if" expression will not work in Xcode. It gives a "parse issue" with the if expression. Any suggestions? The error code is: "Expected unqualified-id". I am working with xcode. Please see below:
if (surfaceArea > 750)
{
totalCost t=50;
}
Thanks in advance,
if (surfaceArea > 750) //adding 50 dollars to cost if product is
//over 750 sq. inches
{
totalCost t+=50;
}
make a comment line // .
Hope you understood.
To write a multi line comment use /* .... */
Just remove over 750 sq. inches from your code. And use /* */ for multiline comments.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 4 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
Why am I getting this problem and how can I fix it? From my point of view I already declared it. Please see the image.
Thanks a lot!
You have an extra semicolon between the for statement and opening brace. That makes the for loop have an empty body, and the braced expressions have no idea what angle is supposed to be, since it truly is out-of-scope.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
Here's the portion of the overall Prepared Statement that I'm having issues with: STR_TO_DATE(?, '%d/%m/%Y %k:%i:%S')
I'm writing in C++ and using a string I'm getting from a data file.
It's inserting 01/01/2017 18:00:10 just fine, but it gets to 12/31/2016 23:59:59 and breaks. I've tried some different combinations but I'm just not getting it.
It is a parsing error, you need to switch days and months you are passing to the function:
STR_TO_DATE(?, '%d/%m/%Y %k:%i:%S')
from 12/31/2016 23:59:59 to 31/12/2016 23:59:59
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I have just started to learn C++ and i would like to get some help.
The user needs to type an ID number and the format has to be the following. The first character B and the other 4 any integer.
Im trying to check if the character format are right.
So far i have this:
if ((isalpha(id[0])=='B' ) && (isdigit(id.at(1))) && (isdigit(id.at(2))) ......
{
//do something
}
else
{
cout << "Wrong format" << endl;
}
but even if i type example B8745 it says wrong format.
You are comparing the result of isalpha, which is boolean, to character literal 'B'.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
double testpower;
testpower = pow(400,-9);
testpower giving me 3.8146972656250003e-024 which is different calculator output of 4E-7
Anyone have any idea why??
calculator output of 4E-7
You entered the wrong calculation into your calculator.
You entered 400×10-9, instead of 400-9.
These are absolutely not the same thing!
The C++ program is correct: pow(400, -9) calculates 400-9, which is approximately 3.815×10-24.
Here is some further reading for you:
http://en.wikipedia.org/wiki/Scientific_notation#E_notation
4E-7 seems like you accidentally input 400 * 10^-9 or 400E-9.
You're looking for 400^-9, which should give 3.8146972656250003e-024.
The result you are getting 3.8146972656250003e-024 is completely correct. Maybe your calculator does not have that precission and that is why you are getting that error. Try to do 1/400^9.
I just tested 400^(-9) on the Windows calculator tool and I got the same output as your program. I think the program is fine, it may be your manual calculation that is the problem here.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Improve this question
Where am I going wrong? I inclduded setprecision(2) but the output comes wrong.
example: if the sum is 23 and n is 10, the answer is 2.00
for(i=3; i<n; i++)
{
sum=sum+marks[i];
}
cout<<"Total marks of the student is "<<sum<<endl;
avg=sum/n;
cout.setf(ios::showpoint);
cout<<setprecision(2)<<fixed;
cout<<"Average marks of the student is "<<avg<<endl;
getch();
That's because you're using the integer division, in which the fractional part (remainder) is discarded.
Change
avg=sum/n;
to
avg=sum/(float)n;