Getting a CE-Please help

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

Moderator: Board moderators

Post Reply
ausiva
New poster
Posts: 6
Joined: Sun Mar 12, 2006 7:01 pm

Getting a CE-Please help

Post by ausiva »

Somehow I get CE even though it runs perfectly in my machine...

Here is the code..please help.

Also, please let me know where do i look for the particular error messages taht the online compiler throws..

Thanks.

Code: Select all

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<cstdio>
using namespace std;

int main()
{
    vector<string> strings;
    string temp;
    vector<string>::const_iterator iter;
    unsigned num=0;
    unsigned count=0;
    unsigned maxLength = 0;
    unsigned cols=0;
    unsigned rows=0;
    int i=0;
    int j=0;

    while(cin>>num)
    {
                   getline(cin,temp);//to read the '\n' after the number
                   maxLength=rows=cols=0;
                   for(count=0;count<num;++count)
                   {
                    getline(cin,temp);
                    maxLength = max(maxLength, unsigned(temp.length()));
                    strings.push_back(temp);
                    }
                    sort(strings.begin(),strings.end());
                    //cout<<maxLength<<endl;
                    //assert(maxLength<=60);
                    cols=(60-maxLength)/(maxLength+2) + 1;
                    rows= (num%cols)?(num/cols+1):(num/cols);
                    
                    i=j=0;
                    //cout<<maxLength<<"\t"<<rows<<"\t"<<cols;
                    //draw a line of dashes
                    while(i++<60)
                                 cout<<'-';
                    for(i=0;i<rows;i++)
                    {
                           cout<<endl;
                           for(j=0;j<cols;j++)
                               if((i+j*rows)<num)
                                    cout<<left<<setw(maxLength+2)<<strings[i+j*rows];
                    }
                    cout<<endl;
                    strings.clear();
   }

   return 0;
}
A1
Experienced poster
Posts: 173
Joined: Wed Jan 28, 2004 3:34 pm
Location: Bangladesh

Post by A1 »

you can get compile error information from the auto email reply by uva(if you does not disable it).
Here I submit your code and get this reply:

Code: Select all

Here are the compiler error messages:

04610901_24.c: In function `int main()':
04610901_24.c:48: `left' undeclared (first use this function)
04610901_24.c:48: (Each undeclared identifier is reported only once
04610901_24.c:48: for each function it appears in.)
ausiva
New poster
Posts: 6
Joined: Sun Mar 12, 2006 7:01 pm

Post by ausiva »

thanks a lot,A1

The replies have been goin to my spam folder...i will look at it now...
Post Reply

Return to “C++”