Page 1 of 1

Why Do I get A Presentation Error PLZ HELP ASAP

Posted: Tue May 05, 2015 8:33 pm
by Axiom2277
#include <iostream>

using namespace std;

int main()
{
int casess,Lines,x=1; cin >> casess; cin.ignore();
string str;
bool flag3=0;

while(casess--)
{
cin >> Lines; cin.ignore();
string s1[Lines];
str.clear();
int a=0;
if(flag3) cout << endl; flag3=1;
cout << "Case " << x++ << ":" << endl;
while(Lines--)
{
bool flag=0,flag2=0;
getline(cin ,str);
if(str[str.size()-1]!=' ')
{ str.insert(str.size()," "); flag2=1; }
if(str.at(0)!=' ')
{ str.insert(0," "); flag=1; }
for(int j=0;j<str.size()-1;j++)
{
if(j<str.size()-1 && j>0 && str.at(j)==' ' && (str.at(j+1)==' ' || str.at(j-1)==' '))
{
str.erase(j,1); j=0;
}
}
if(flag2==1)
str.erase(str.size()-1,1);
if(flag==1)
str.erase(0,1);

cout << str << endl;
}
}
}

Re: Why Do I get A Presentation Error PLZ HELP ASAP

Posted: Tue May 26, 2015 6:02 am
by predicate
You should at least tell the problem name and id before putting up your code.