Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code in not running #4215

Closed
3 tasks done
sakaldevverm opened this issue Oct 10, 2024 · 2 comments
Closed
3 tasks done

Code in not running #4215

sakaldevverm opened this issue Oct 10, 2024 · 2 comments

Comments

@sakaldevverm
Copy link

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

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: left
Actual value was -1.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)   
   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)

Screenshot

Screenshot (164)

Environment data

PS C:\Users\HP\Desktop\Coding\C++ Coding> cd "c:\Users\HP\Desktop\Coding\C++ Coding\BasicProgram\" ; if ($?) { g++ basicCode.cpp -o basicCode } ; if ($?) { .\basicCode }
basicCode.cpp:17:78: error: stray '\' in program
     $os = if ($IsLinux -or $IsMacOS) { uname -a } else { (dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion }

                 ^
basicCode.cpp:17:87: error: stray '\' in program
     $os = if ($IsLinux -or $IsMacOS) { uname -a } else { (dir $env:SystemRoot\System32\cmd.exe).VersionInfo.FileVersion }

                          ^
basicCode.cpp:19:16: error: empty character constant
     Write-Host ''
                ^~
basicCode.cpp:27:16: error: empty character constant
     Write-Host ''
                ^~
basicCode.cpp:1:3: error: expected unqualified-id before '{' 
token
 & {
   ^
basicCode.cpp:1:3: error: expected constructor, destructor, or type conversion before '{' token
PS C:\Users\HP\Desktop\Coding\C++ Coding\BasicProgram>

Steps to reproduce

#include
using namespace std;

class Student{
string name;
int rollNo;
float marks[5];
public:
void input();
void show();
void tot_marks();
};

void Student::input(){
cout << "Enter name: ";
getline(cin, name);
cout << "Enter roll number: ";
cin >> rollNo;
cout << "Enter marks (5 subjects): ";
for(int i=0; i<5; i++){
cout << "Subject " << (i+1) << ": "; // to display subject number
cin >> marks[i];
}
}

void Student::show(){
cout << "Name: " << name << endl;
cout << "Roll number: " << rollNo << endl;
cout << "Marks: "<<endl;
for(int i=0; i<5; i++){
cout << "Subject " <<(i+1) << ": " << marks[i] << endl;
// cout << marks[i] << " ";
}
cout << endl;
}

void Student::tot_marks(){
float total = 0;
for(int i=0; i<5; i++){
total += marks[i];
}
cout << "Total marks: " << total;
}

int main(){
Student s;
s.input();
s.show();
s.tot_marks();
return 0;
}

Expected behavior

Screenshot (163)

Actual behavior

Uploading Screenshot (161).png…

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 10, 2024
Copy link

This issue was already fixed (see #1306). Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery.
See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 10, 2024
@sakaldevverm
Copy link
Author

please ensure that it does not repeat again......thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant