PRESENTATION ERROR

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Axiom2277
New poster
Posts: 3
Joined: Mon May 04, 2015 9:02 am

PRESENTATION ERROR

Post by Axiom2277 » Mon May 04, 2015 5:45 pm

HELP PLZ WHY DO I GET PRESENTATION ERROR????

Code: Select all


#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;
        }
    }
}

predicate
New poster
Posts: 18
Joined: Tue Jun 17, 2014 9:32 pm
Location: Hyderabad, India

Re: PRESENTATION ERROR

Post by predicate » Sun Jun 07, 2015 7:55 pm

You should always tell the problem number before you put the up the code.

Post Reply

Return to “C++”

Who is online

Users browsing this forum: No registered users and 1 guest