-
Notifications
You must be signed in to change notification settings - Fork 316
Closed
Description
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
Last 129 Keys:
c d Space ' d : \ C O D I N G Space c a r e e r \ C O D E F O R C E S \ c o d e f o r c e s Space c o n t e s t s \ c o n t e s t Space 9 5 3 Space d i v Space 2 Space c o d e f o r c e s \ p r o b l e m Space a \ o u t p u t ' Enter
& Space . \ ' p r o b l e m Space a l i c e Space b o o k s . e x e ' 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: 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
Environment data
PS Version: 5.1.19041.4412
PS HostName: ConsoleHost
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 3000
Steps to reproduce
unable to run c programs like these
#include<stdio.h>
#include<stdlib.h>
int main(){
int t;
int n;
int p;
int i;
for(i=0; i<t; i++){
scanf("%d", &t); // input test cases
for(i=0; i<t; i++){
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &p);
}
}
if(n=2){
printf("%d", p+p);
}
}
Program 2
#include <stdio.h>
#include <stdlib.h>
int compare(const void a, const void b) {
return ((int)b - (int)a);
}
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
int books[n];
for (int i = 0; i < n; i++) {
scanf("%d", &books[i]);
}
// Sort the books array in descending order
qsort(books, n, sizeof(int), compare);
// The maximum total number of pages Alice can read is the sum of the two highest values
int max_pages = books[0] + books[1];
printf("%d\n", max_pages);
}
return 0;
}
return 0;}
Expected behavior
The C program should run on vs code terminal.
Actual behavior
It keeps showing error for simple c programs like printf hello too.
Metadata
Metadata
Assignees
Labels
No labels