#include <iostream>
#include <conio.h>
using namespace std;
main() {
double x = 7 + 1 * (4 * ( 5 - ( 9 + 3 ) / 6 ) ) ;
cout << "el resultado de x es: " <<x;
getch();
}
#include <iostream>
#include <conio.h>
using namespace std;
main() {
double x = 7 + 1 * (4 * ( 5 - ( 9 + 3 ) / 6 ) ) ;
cout << "el resultado de x es: " <<x;
getch();
}
As you have already been told, the character for subtraction is incorrect. The minus sign that you use corresponds to the value 226 in octal or 96 in hexadecimal of the extended ASCII code. The minus sign should be the 2D value in hexadecimal (55 octal). Although both show the same when printed in most editors, the compiler does not think the same.
This error is very common when copying and pasting code from documents from text editors such as Word.
On the other hand, I do not know what they said but if you want to follow the c ++ standard the function main()
must always return an integer . You can look at the official documentation about it here .
The code will look like this:
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
double x = 7 + 1 * (4 * ( 5 - ( 9 + 3 ) / 6 ) ) ;
cout << "el resultado de x es: " << x;
getch();
return 0;
}
The problem with your implementation is that there is an invalid character. It seems that it is correct, but you must change it. I mean the '-' sign in the operation.
I think your operation has an operator that does not recognize c ++, in the "-" part it may be a script
Octal = 226 Decimal= 2×8²+2×8¹+6×8⁰ = 150 Binary = 10010110 Hex = 96
or maybe your result is being interpreted as unknown