#include<iostream>
#include<string>
using namespace std;
int main(){
[the image shows the error I keep getting]
string st("HabibRehman");
string a="", b="";
int y=st.length();
int d=y/2;
int f;
f=d;
for(int i=1;i<st.length();i++){
for( int j=0;j<y;j++){
cout<<" ";
}
for(int k=0;k<1;k++)/*I'm not sure what this loop should be*/{
cout<<a+st.substr(d,i)<<endl;
/*int d=(st.length()/2);
static int f=d;//I was trying to keep the values static here
static int g=d;*/
//this doesn't work in here
}
--f;//if i put this outside the for loop it works wrong without the termination error.
a=st.substr(f,i);//I'm using this to get the value prior to the st.substr(d,i)
y--;
}
system("pause");
retu 0;
}
I keep getting a termination error. Ive tried almost everything I knew like changing the loops, the positions of substrings and variables, when I get the output I want, the program gives me an termination error, otherwise it gives me a wrong output without the termination error.
