I'm just so frustrated with this issue. My code is ok. I have checked it in different online compilers. Here is the code:
Not only this code, but all code that I'm trying to run in VS Code terminal, it's showing me this:
Unexpected token 'tut7.4' in expression or statement
My file name is tut7.4.cpp
. Yesterday I could run all the code in the VS Code cmd terminal. But today it's not running in the cmd terminal in VS Code. It's running in the Powershell terminal in VS Code. I want to run my code in cmd in vs code. Not a single code is running. Almost all the codes are showing the same result. I am not getting the problem.
#include <iostream>
using namespace std;
int main()
{
int i, fact = 1, n;
cout << "Enter the Number: ";
cin >> n;
for (i = 1; i <= n; i++)
{
fact = (fact * i);
}
cout << "Factorial: " << fact;
return 0;
}
Error:
"PowerShell 7.1.4
Copyright (c) Microsoft Corporation.
https://aka.ms/powershell
Type 'help' to get help.
PS D:\D DRIVE\programming VS\Code with harry\C++A> cd "d:\D DRIVE\programming VS\Code with harry\C++A\" && g++ tut7.4.cpp -o tut7.4 && "d:\D DRIVE\programming VS\Code with harry\C++A\"tut7.4
ParserError:
Line
1 | … -o tut7.4 && "d:\D DRIVE\programming VS\Code with harry\C++A\"tut7.4
| ~~~~~~
| Unexpected token 'tut7.4' in expression or statement.
PS D:\D DRIVE\programming VS\Code with harry\C++A>"