You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search the existing issues, especially the pinned issues.
Exception report
Last 200 Keys: . \ s t a c k _ w i t h o u t _ u s i n g _ s t l Space } Enter c d Space " c : \ U s e r s \ W i n \ O O P S Space C O N C E P T S \ c o m p l e x _ l i n k e d _ l i s t \ s t a c k \ " Space ; Space i f Space ( $ ? ) Space { Space g + + Space s t a c k _ w i t h o u t _ u s i n g _ s t l . c p p Space - o Space s t a c k _ w i t h o u t _ u s i n g _ s t l Space } Space ; Space i f Space ( $ ? ) Space { Space . \ s t a c k _ w i t h o u t _ u s i n g _ s t l Space } EnterException:or equal to zero and less than the console's buffer size in that dimension.Parameter name: topActual 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)
#include
using namespace std;
class Stack{
public:
int top;
int *arr;
int size;
Stack(int size){
arr=new int[size];
this->size=size;
top= -1;
}
//functions
void push(int data){
//2 scenarios: space available nd space not available i.e. if stack is already full or a empty space is there for insertion of an element
if(size-top> 1){
//if space is available then top index is increased and in the array at that index new element will be inserted
top++;
arr[top]= data;
}
else{
//if space is not available
cout<<"Stack overflow"<<endl;
}
}
void pop(){
if(top==-1){
//if stack is already empty, no element is there to remove
cout<<"Stack Underflow"<<endl;
}
else{
//This will eventually point to the previous element of the already old pointed top just top-- will now point to the previous element it will give the index of that previous element
top--;
}
}
int getTop(){
if(top==-1){
cout<<"There is no elemet in the stack"<<endl;
}
else{
return arr[top];
}
}
int getsize(){
//This will give the no. of valid elements present in the stack top to inde ko bta hi rha hh to usme +1 kr do it will give you the total element sof the stack bcoz top hi apko last element ka index deta hh
return top+1;
}
bool isempty(){
if(top==-1){
return 1;
}
else return 0;
}
};
int main(){
//stack creation we have to give the size of the array as in the constructor we have defined the paramter of size so size of array is passed of 10
Stack s(4);
//insertion
s.push(34);
s.push(21);
s.push(70);
s.push(90);
s.push(30);
while(s.isempty()!=1){
cout<<s.getTop()<<" ";
s.pop();
}
cout<<endl;
cout<<"Size of stack as all the elemnts are removed bcoz of popping them to get them printed:"<<s.getsize();
s.pop();
return 0;
}
Expected behavior
NA
Actual behavior
NA
The text was updated successfully, but these errors were encountered:
@swagger20, you were using a pretty old version of PSReadLine (2.0.0-beta2 or prior), and it's likely that the issue was fixed in a newer version.
Please upgrade to the 2.3.4 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.
Prerequisites
Exception report
Screenshot
![](https://github.com/PowerShell/PSReadLine/assets/133804817/cd983561-cfb0-4111-a7ce-74244aa
8d4ba)
Environment data
Steps to reproduce
#include
using namespace std;
class Stack{
public:
int top;
int *arr;
int size;
Stack(int size){
arr=new int[size];
this->size=size;
top= -1;
}
//functions
void push(int data){
//2 scenarios: space available nd space not available i.e. if stack is already full or a empty space is there for insertion of an element
if(size-top> 1){
//if space is available then top index is increased and in the array at that index new element will be inserted
top++;
arr[top]= data;
}
else{
//if space is not available
cout<<"Stack overflow"<<endl;
}
}
void pop(){
if(top==-1){
//if stack is already empty, no element is there to remove
cout<<"Stack Underflow"<<endl;
}
else{
//This will eventually point to the previous element of the already old pointed top just top-- will now point to the previous element it will give the index of that previous element
top--;
}
}
int getTop(){
if(top==-1){
cout<<"There is no elemet in the stack"<<endl;
}
else{
return arr[top];
}
}
int getsize(){
//This will give the no. of valid elements present in the stack top to inde ko bta hi rha hh to usme +1 kr do it will give you the total element sof the stack bcoz top hi apko last element ka index deta hh
return top+1;
}
bool isempty(){
if(top==-1){
return 1;
}
else return 0;
}
};
int main(){
//stack creation we have to give the size of the array as in the constructor we have defined the paramter of size so size of array is passed of 10
Stack s(4);
//insertion
s.push(34);
s.push(21);
s.push(70);
s.push(90);
s.push(30);
while(s.isempty()!=1){
cout<<s.getTop()<<" ";
s.pop();
}
cout<<endl;
cout<<"Size of stack as all the elemnts are removed bcoz of popping them to get them printed:"<<s.getsize();
s.pop();
return 0;
}
Expected behavior
NA
Actual behavior
NA
The text was updated successfully, but these errors were encountered: