+ 2
What could be the problem?
So basically my code is failing to compile because it says I'm using an unqualified id before the numeric constant. float num1 = 123.456F; float num2 = 76.234F; It keeps saying there's an error, any tips on how to fix that part of my code?
17 odpowiedzi
+ 4
Yes , that last F must be f .
Small letter not capital letter
+ 4
Bro these languages are case sensitive, so f and F are very different things
+ 3
Your rectified code is
https://code.sololearn.com/cubc554xKch8/?ref=app
+ 3
Akebu just check it ,
+ 1
But technically speaking lowercase 'f'and uppercase 'F' are the same in C++ with the uppercase 'F' being the recommended one when using floats.
Anyway I tried that but it says the problem is the the num1 and num2
+ 1
Yes I know that, that's why F is the recommended one when dealing with C++ because of the destinction.
It still won't won't either way because that's not the problem
+ 1
The two lines themselves seem to be fine. Maybe you can link the entire code for us?
+ 1
The error is in line 5 , here 123,456F is wrong
Correct is 123.456F
+ 1
@Ray Kalash Tiwari thanks
+ 1
Your welcome bro
0
Here's the code:
#include <iostream>
using namespace std;
int main ()
{
float num1 = 123.456F;
float num2 = 76.234F;
float sum, difference;
sum = num1 + num2;
cout << "Total: " << num1 << " + " << num2;
cout << " = " << sum;
difference = num1 - num2;
cout << "Total: " << num1 << " - " << num2;
cout << " = " << difference;
return 0;
}
0
Is ur problem solved???
0
Yes it is
- 1
Lex Flexz Hello!
- 1
Привет
- 2
Hello
- 2
My