Skip to content

vs code bug report #3871

Closed
Closed
@Supreme24

Description

@Supreme24

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

PS C:\Users\RAJESH> #include <iostream>
PS C:\Users\RAJESH> #include <cstdlib>
PS C:\Users\RAJESH> #include <ctime>
PS C:\Users\RAJESH> 
PS C:\Users\RAJESH> // Define preprocessor constants for ROCK, PAPER and SCISSORS which will 
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path 
is correct and try again.
At line:1 char:1
+ // Define preprocessor constants for ROCK, PAPER and SCISSORS which w ...
+ ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH> // represent with the integers 1-3.  We'll randomly select an integer from 
>> // 1-3 to represent the "AI move".  Using these constants in our program also
>> // makes it easier to read than directly using 1,2,3.
>> #define ROCK 1
>> #define PAPER 2
>> #define SCISSORS 3
>>
>> using namespace std;
>>
>> int main()
>> {
>>   // Seed the random number generator with the current time to ensure the
>>   // possibility of different sequences of random numbers each time the program
>>   // is executed.
>>   srand((unsigned int) time(NULL));
>>
>>   // player_throw stores the player's throw, ai_throw stores the AI's throw,
>>   // and draw keeps track of whether the game ended in a draw or not (if draw
>>   // is true the game ended in a draw, in which case the game is played again)
>>   int player_throw = 0;
>>
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 Space a n d Space t h e Space l o o p Space c o n d i t i o n Enter
 Space Space / / Space w i l l Space b e Space t r u e Space c a u s i n g Space t h e Space g a m e Space t o Space b e Space p l a y e d Space a g a i n , Space o t h e r w i s e Space i f Space d r a w Space i s Space Enter
 Space Space / / Space f a l s e Space t h e Space l o o p Space w i l l Space s t o p Space a n d Space t h e Space g a m e Space i s Space n o t Space p l a y e d Space a g a i n Space Space Space Enter
 Space Space } Space w h i l e Space ( d r a w ) ; Enter
 Enter
 Space Space r e t u r n Space 0 ; Enter
 } Enter


Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -1.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
PS C:\Users\RAJESH> // represent with the integers 1-3.  We'll randomly select an integer from 
>> // 1-3 to represent the "AI move".  Using these constants in our program also
>> // makes it easier to read than directly using 1,2,3.
>> #define ROCK 1
>> #define PAPER 2
>> #define SCISSORS 3
>>
>> using namespace std;
>>
>> int main()
>> {
>>   // Seed the random number generator with the current time to ensure the
>>   // possibility of different sequences of random numbers each time the program
>>   // is executed.
>>   srand((unsigned int) time(NULL));
>>
>>   // player_throw stores the player's throw, ai_throw stores the AI's throw,
>>   // and draw keeps track of whether the game ended in a draw or not (if draw
>>   // is true the game ended in a draw, in which case the game is played again)
>>   int player_throw = 0;
>>   int ai_throw = 0;
>>   bool draw = false;
>>   
>>   // Continually play the game until there is a winner
>>   do
>>   {
>>     // Prompt the user to enter their throw, store it into player_throw
>>     cout << "Select your throw." << endl;
>>     cout << "1) Rock" << endl;
>>     cout << "2) Paper" << endl;
>>     cout << "3) Scissors" << endl;
>>     cout << "Selection: ";
>>     cin >> player_throw;
>>
>>     // Output an endl (newline) to separate the user input from the game output
>>     cout << endl;
>>
>>     // Randomly select an integer from 1-3 to represent the AI throw.  The
>>     // rand() function returns a ra
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 Space a n d Space t h e Space l o o p Space c o n d i t i o n Enter
 Space Space / / Space w i l l Space b e Space t r u e Space c a u s i n g Space t h e Space g a m e Space t o Space b e Space p l a y e d Space a g a i n , Space o t h e r w i s e Space i f Space d r a w Space i s Space Enter
 Space Space / / Space f a l s e Space t h e Space l o o p Space w i l l Space s t o p Space a n d Space t h e Space g a m e Space i s Space n o t Space p l a y e d Space a g a i n Space Space Space Enter
 Space Space } Space w h i l e Space ( d r a w ) ; Enter
 Enter
 Space Space r e t u r n Space 0 ; Enter
 } Enter


Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -19.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
PS C:\Users\RAJESH> // represent with the integers 1-3.  We'll randomly select an integer from 
>> // 1-3 to represent the "AI move".  Using these constants in our program also
>> // makes it easier to read than directly using 1,2,3.
>> #define ROCK 1
>> #define PAPER 2
>> #define SCISSORS 3
>> 
>> using namespace std;
>>
>> int main()
>> {
>>   // Seed the random number generator with the current time to ensure the
>>   // possibility of different sequences of random numbers each time the program
>>   // is executed.
>>   srand((unsigned int) time(NULL));
>>
>>   // player_throw stores the player's throw, ai_throw stores the AI's throw,
>>   // and draw keeps track of whether the game ended in a draw or not (if draw
>>   // is true the game ended in a draw, in which case the game is played again)
>>   int player_throw = 0;
>>   int ai_throw = 0;
>>   bool draw = false;
>>
>>   // Continually play the game until there is a winner
>>   do
>>   {
>>     // Prompt the user to enter their throw, store it into player_throw
>>     cout << "Select your throw." << endl;
>>     cout << "1) Rock" << endl;
>>     cout << "2) Paper" << endl;
>>     cout << "3) Scissors" << endl;
>>     cout << "Selection: ";
>>     cin >> player_throw;
>>
>>     // Output an endl (newline) to separate the user input from the game output
>>     cout << endl;
>>
>>     // Randomly select an integer from 1-3 to represent the AI throw.  The
>>     // rand() function returns a random integer between 0 and a very large
>>     // positive integer.  If we take any integer in this range and apply
>>     // "modulus 3", i.e. rand() % 3, we will get an integer in the range 0-2.
>>     // This is because % 3 returns the remainder of dividing by 3, and the
>>     // only possibilities for a remainder after division by 3 are 0,1,2. We
>>     // then add 1 to this with +1 to shift the range up from 0-2 to 1-3.
>>     ai_throw = (rand() % 3) + 1;
>>
>>     // Output the AI throw so the player knows what it is
>>     if (ai_throw == ROCK)
>>     {
>>       cout << "AI throws ROCK." << endl;
>>     }
>>     else if (ai_throw == PAPER)
>>     {
>>       cout << "A
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 200 Keys:
 Space a n d Space t h e Space l o o p Space c o n d i t i o n Enter
 Space Space / / Space w i l l Space b e Space t r u e Space c a u s i n g Space t h e Space g a m e Space t o Space b e Space p l a y e d Space a g a i n , Space o t h e r w i s e Space i f Space d r a w Space i s Space Enter
 Space Space / / Space f a l s e Space t h e Space l o o p Space w i l l Space s t o p Space a n d Space t h e Space g a m e Space i s Space n o t Space p l a y e d Space a g a i n Space Space Space Enter
 Space Space } Space w h i l e Space ( d r a w ) ; Enter
 Enter
 Space Space r e t u r n Space 0 ; Enter
 } Enter


Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -34.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
-----------------------------------------------------------------------
PS C:\Users\RAJESH> // represent with the integers 1-3.  We'll randomly select an integer from 
>> // 1-3 to represent the "AI move".  Using these constants in our program also
>> // makes it easier to read than directly using 1,2,3.
>> #define ROCK 1
>> #define PAPER 2
>> #define SCISSORS 3
>>
>> using namespace std;
>>
>> int main()
>> {
>>   // Seed the random number generator with the current time to ensure the
>>   // possibility of different sequences of random numbers each time the program
>>   // is executed.
>>   srand((unsigned int) time(NULL));
>>
>>   // player_throw stores the player's throw, ai_throw stores the AI's throw,
>>   // and draw keeps track of whether the game ended in a draw or not (if draw
>>   // is true the game ended in a draw, in which case the game is played again)
>>   int player_throw = 0;
>>   int ai_throw = 0;
>>   bool draw = false;
>>
>>   // Continually play the game until there is a winner
>>   do
>>   {
>>     // Prompt the user to enter their throw, store it into player_throw
>>     cout << "Select your throw." << endl;
>>     cout << "1) Rock" << endl;
>>     cout << "2) Paper" << endl;
>>     cout << "3) Scissors" << endl;
>>     cout << "Selection: ";
>>     cin >> player_throw;
>>
>>     // Output an endl (newline) to separate the user input from the game output
>>     cout << endl;
>>
>>     // Randomly select an integer from 1-3 to represent the AI throw.  The
>>     // rand() function returns a random integer between 0 and a very large
>>     // positive integer.  If we take any integer in this range and apply
>>     // "modulus 3", i.e. rand() % 3, we will get an integer in the range 0-2.
>>     // only possibilities for a remainder after division by 3 are 0,1,2. We
>>     // then add 1 to this with +1 to shift the range up from 0-2 to 1-3.
>>     ai_throw = (rand() % 3) + 1;
>>
>>     // Output the AI throw so the player knows what it is
>>     if (ai_throw == ROCK)
>>     {
>>       cout << "AI throws ROCK." << endl;
>>     {
>>       cout << "AI throws PAPER." << endl;
>>     }
>>     else if (ai_throw == SCISSORS)
>>     {
>>       cout << "AI throws SCISSORS." << endl;
>>     }
>>
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:1
+ // represent with the integers 1-3.  We'll randomly select an integer ...
+ ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>     // Next we check the result of the game.  In the case that both players 
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:5
+     // Next we check the result of the game.  In the case that both p ...
+     ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\RAJESH>     // make the same throw, the game is a draw, and we output this and set
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:5
+     // make the same throw, the game is a draw, and we output this an ...
+     ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\RAJESH>     // draw to true to play the game again.  Otherwise we output whether
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:5
+     ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>     // the player has won or lost based on the state of the game.
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:5
+     // the player has won or lost based on the state of the game.
+     ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>
PS C:\Users\RAJESH>     if (player_throw == ai_throw)
>>     {
>>       draw = true;
>>       cout << "Draw! Play again!" << endl;
>>     }
At line:4 char:13
+       cout << "Draw! Play again!" << endl;
+             ~
Missing file specification after redirection operator.
At line:4 char:12
+       cout << "Draw! Play again!" << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "Draw! Play again!" << endl;
+             ~
The '<' operator is reserved for future use.
At line:4 char:36
+       cout << "Draw! Play again!" << endl;
+                                    ~
Missing file specification after redirection operator.
At line:4 char:35
+       cout << "Draw! Play again!" << endl;
The '<' operator is reserved for future use.
At line:4 char:36
+       cout << "Draw! Play again!" << endl;
+                                    ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == ROCK && ai_throw == SCISSORS)
At line:1 char:35
+     else if (player_throw == ROCK && ai_throw == SCISSORS)
+                                   ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
>>     }
At line:2 char:13
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
+             ~
The '<' operator is reserved for future use.
At line:2 char:48
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
+                                                ~
Missing file specification after redirection operator.
At line:2 char:47
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
The '<' operator is reserved for future use.
At line:2 char:48
+       cout << "ROCK beats SCISSORS! YOU WIN." << endl;
+                                                ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == ROCK && ai_throw == PAPER)
At line:1 char:35
+     else if (player_throw == ROCK && ai_throw == PAPER)
+                                   ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "PAPER beats ROCK! YOU LOSE." << endl;
>>     }
At line:2 char:13
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
+             ~
The '<' operator is reserved for future use.
At line:2 char:46
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
+                                              ~
Missing file specification after redirection operator.
At line:2 char:45
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
The '<' operator is reserved for future use.
At line:2 char:46
+       cout << "PAPER beats ROCK! YOU LOSE." << endl;
+                                              ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == PAPER && ai_throw == ROCK)
At line:1 char:36
+     else if (player_throw == PAPER && ai_throw == ROCK)
+                                    ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "PAPER beats ROCK! YOU WIN." << endl;
>>     }
At line:2 char:13
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
+             ~
The '<' operator is reserved for future use.
At line:2 char:45
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
+                                             ~
Missing file specification after redirection operator.
At line:2 char:44
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
The '<' operator is reserved for future use.
At line:2 char:45
+       cout << "PAPER beats ROCK! YOU WIN." << endl;
+                                             ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == PAPER && ai_throw == SCISSORS)
At line:1 char:36
+     else if (player_throw == PAPER && ai_throw == SCISSORS)
+                                    ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
>>     }
At line:2 char:13
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
+             ~
The '<' operator is reserved for future use.
At line:2 char:50
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
+                                                  ~
Missing file specification after redirection operator.
At line:2 char:49
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
The '<' operator is reserved for future use.
At line:2 char:50
+       cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
+                                                  ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == SCISSORS && ai_throw == PAPER)
At line:1 char:39
+     else if (player_throw == SCISSORS && ai_throw == PAPER)
+                                       ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
>>     }
At line:2 char:13
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
+            ~
The '<' operator is reserved for future use.
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
+             ~
The '<' operator is reserved for future use.
At line:2 char:49
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
+                                                 ~
Missing file specification after redirection operator.
At line:2 char:48
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
The '<' operator is reserved for future use.
At line:2 char:49
+       cout << "SCISSORS beats PAPER! YOU WIN." << endl;
+                                                 ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     else if (player_throw == SCISSORS && ai_throw == ROCK)
At line:1 char:39
+     else if (player_throw == SCISSORS && ai_throw == ROCK)
+                                       ~~
The token '&&' is not a valid statement separator in this version.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidEndOfLine
 
PS C:\Users\RAJESH>     {
>>       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
>>     }
At line:2 char:13
+       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
+             ~
Missing file specification after redirection operator.
At line:2 char:12
+       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
+            ~
The '<' operator is reserved for future use.
+             ~
The '<' operator is reserved for future use.
At line:2 char:49
+       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
+                                                 ~
Missing file specification after redirection operator.
At line:2 char:48
+       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
The '<' operator is reserved for future use.
At line:2 char:49
+       cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
+                                                 ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>     // Output an endl (newline) to separate the game output from the user 
newline : The term 'newline' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that  
the path is correct and try again.
At line:1 char:24
+     // Output an endl (newline) to separate the game output from the  ...
+                        ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (newline:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>     // input in the case that the game is played again
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:5
+     // input in the case that the game is played again
+     ~~
 
PS C:\Users\RAJESH>     cout << endl;
At line:1 char:11
+     cout << endl;
+           ~
Missing file specification after redirection operator.
At line:1 char:10
+     cout << endl;
The '<' operator is reserved for future use.
At line:1 char:11
+     cout << endl;
+           ~
The '<' operator is reserved for future use.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingFileSpecification
 
PS C:\Users\RAJESH>   // if draw is true this means the game ended in a draw, and the loop condition
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:3
+   // if draw is true this means the game ended in a draw, and the loo ...
+   ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
PS C:\Users\RAJESH>   // will be true causing the game to be played again, otherwise if draw is
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
is correct and try again.
At line:1 char:3
+   // will be true causing the game to be played again, otherwise if d ...
+   ~~
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>   // false the loop will stop and the game is not played again
// : The term '//' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path   
+   // false the loop will stop and the game is not played again
    + CategoryInfo          : ObjectNotFound: (//:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
PS C:\Users\RAJESH>   } while (draw);
At line:1 char:3
+   } while (draw);
+   ~
Unexpected token '}' in expression or statement.
At line:1 char:17
+   } while (draw);
+                 ~
Missing statement body in while loop.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken
 
PS C:\Users\RAJESH>
PS C:\Users\RAJESH>   return 0;
0
PS C:\Users\RAJESH> }
At line:1 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

Screenshot

  • Executing task: msbuild /property:GenerateFullPaths=true /t:build /consoleloggerparameters:NoSummary

msbuild : The term 'msbuild' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1

  • msbuild /property:GenerateFullPaths=true /t:build /consoleloggerparam ...
  •   + CategoryInfo          : ObjectNotFound: (msbuild:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

Environment data

PS Version: 5.1.19041.3693
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 191
BufferHeight: 20

Steps to reproduce

#include
#include
#include

// Define preprocessor constants for ROCK, PAPER and SCISSORS which will
// represent with the integers 1-3. We'll randomly select an integer from
// 1-3 to represent the "AI move". Using these constants in our program also
// makes it easier to read than directly using 1,2,3.
#define ROCK 1
#define PAPER 2
#define SCISSORS 3

using namespace std;

int main()
{
// Seed the random number generator with the current time to ensure the
// possibility of different sequences of random numbers each time the program
// is executed.
srand((unsigned int) time(NULL));

// player_throw stores the player's throw, ai_throw stores the AI's throw,
// and draw keeps track of whether the game ended in a draw or not (if draw
// is true the game ended in a draw, in which case the game is played again)
int player_throw = 0;
int ai_throw = 0;
bool draw = false;

// Continually play the game until there is a winner
do
{
// Prompt the user to enter their throw, store it into player_throw
cout << "Select your throw." << endl;
cout << "1) Rock" << endl;
cout << "2) Paper" << endl;
cout << "3) Scissors" << endl;
cout << "Selection: ";
cin >> player_throw;

// Output an endl (newline) to separate the user input from the game output
cout << endl;

// Randomly select an integer from 1-3 to represent the AI throw.  The 
// rand() function returns a random integer between 0 and a very large 
// positive integer.  If we take any integer in this range and apply 
// "modulus 3", i.e. rand() % 3, we will get an integer in the range 0-2.
// This is because % 3 returns the remainder of dividing by 3, and the 
// only possibilities for a remainder after division by 3 are 0,1,2. We 
// then add 1 to this with +1 to shift the range up from 0-2 to 1-3.
ai_throw = (rand() % 3) + 1;

// Output the AI throw so the player knows what it is
if (ai_throw == ROCK)
{
  cout << "AI throws ROCK." << endl;
}
else if (ai_throw == PAPER)
{
  cout << "AI throws PAPER." << endl;
}
else if (ai_throw == SCISSORS)
{
  cout << "AI throws SCISSORS." << endl;
}

// We'll set draw to false, and only set it to true if there is a draw
draw = false;

// Next we check the result of the game.  In the case that both players 
// make the same throw, the game is a draw, and we output this and set 
// draw to true to play the game again.  Otherwise we output whether 
// the player has won or lost based on the state of the game.

if (player_throw == ai_throw)
{
  draw = true;
  cout << "Draw! Play again!" << endl;
}
else if (player_throw == ROCK && ai_throw == SCISSORS)
{
  cout << "ROCK beats SCISSORS! YOU WIN." << endl;
}
else if (player_throw == ROCK && ai_throw == PAPER)
{
  cout << "PAPER beats ROCK! YOU LOSE." << endl;
}
else if (player_throw == PAPER && ai_throw == ROCK)
{
  cout << "PAPER beats ROCK! YOU WIN." << endl;
}
else if (player_throw == PAPER && ai_throw == SCISSORS)
{
  cout << "SCISSORS beats PAPER! YOU LOSE." << endl;
}
else if (player_throw == SCISSORS && ai_throw == PAPER)
{
  cout << "SCISSORS beats PAPER! YOU WIN." << endl;
}
else if (player_throw == SCISSORS && ai_throw == ROCK)
{
  cout << "ROCK beats SCISSORS! YOU LOSE." << endl;
}

// Output an endl (newline) to separate the game output from the user 
// input in the case that the game is played again
cout << endl;

// if draw is true this means the game ended in a draw, and the loop condition
// will be true causing the game to be played again, otherwise if draw is
// false the loop will stop and the game is not played again
} while (draw);

return 0;
}

run this code will know the issue then

Expected behavior

it should run the code after clicking the run c++ active file, build the task or other processes.

Actual behavior

It is showing failures term is not recognized in cmdlet and many more errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions