Does it matter whether I use a x86 or 64 bit? |
Not at this stage.
The program you shared contains many typos. The machine cannot process instructions that are full of spelling errors. Think of your code like a math formula, or part of a mathematical proof. Small mistakes render the whole thing nonsense.
In this case, you've forgotten to double-quote
math.h and
pch.h, and you've written a colon where a double quote is required, in the line
cout << “The temperature in Celsius is” << temp_c << :\n”;
There are other issues that aren't simple misspellings.
The minus sign in your program,
–
, is not a minus sign but rather a character named
U+2013 : EN DASH. This character cannot appear in C++ programs. You are required to use
-
,
U+002D : HYPHEN-MINUS instead.
Similarly, the double quote character used in your program,
“
, is called
U+201C : LEFT DOUBLE QUOTATION MARK. This character can't appear in C++ programs. Straight quotes,
"
, called
U+0022 : QUOTATION MARK must be used instead.
When this problem occurs, it's usually for one of two reasons:
1. You're copying your code from somewhere that uses funky characters (e.g., out of an e-book or a website) instead of typing it yourself; or
2. You're editing code using an unsuitable program (e.g., Microsoft Word or Libreoffice).
The solution is to (re-)write the code you want in a plain-text editor. VS 2019 contains an editor for this purpose.
Here is your code with the issues corrected:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
float temp_f{}, temp_c{};
cout << "Enter temperature in Fahrenheit" << endl;
cin >> temp_f;
temp_c = (temp_f - 32) * (5.0 / 9.0);
cout << "The temperature in Celsius is " << temp_c << "\n";
}
|