noip1998 拼数-练习类

写的丑死


未AC

搞不懂


//#include "stdafx.h"
#include 
#include 
#include 
using namespace std;


class LINT
{
    friend ostream& operator<<(ostream& out, LINT& e);
private :
    char num[100];
public  :
    LINT(){num[0]='\0';}
    LINT(char *m){strcpy(num,m);}
    LINT(int a);
    bool operator>(const LINT& m);
    
};
/*
功能:初始化
输入:int a
输出:
日期:
*/
LINT::LINT(int a)
{
    if (a==0) { num[0]='0';num[1]='\0';return;}
    int i=0;
    while (a)
    {
        num[i++] =  a % 10;
        a /= 10;
    }
    num[i]='\0';
    int len = strlen(num);
    for (i=0; ib 成立 1 否则 0
日期
*/
bool LINT::operator>(const LINT &m)
{
    return strcmp(num, m.num)>0;
}
/*
功能:重载输出运算符
输入:LINT e
输出:
日期:
*/
ostream& operator<<(ostream &out, LINT& e)
{
    out<n[j])
            {
                LINT tmp = n[j+1];
                n[j+1] = n[j];
                n[j]=tmp;
            }
        }
    }
}

/*
功能:输出显示
输入:无
输出:无
日期:
*/
void LIST::Print()
{
    for (int i=0; i>(istream &in,STRING& str);
    friend ostream& operator<<(ostream &out,STRING& str);
private :
    char n[1000];
public :
    STRING(){n[0]='\0';}
    STRING* Split(char a);
    int GetLen();
    char * ConvertToCharArray();
};

int STRING::GetLen(){return strlen(n); }
STRING* STRING::Split(char a)
{
    STRING* pStr = new STRING[100];
    int k=0,kp=0;
    int len = strlen(n);
    for (int i=0; i>(istream&in ,STRING&str)
{
    gets(str.n);
    return in;
}
ostream& operator<<(ostream&out, STRING&str)
{
    out<>k;
    getchar();
    STRING str;
    cin>>str;
    STRING * pStr = str.Split(' ');

    int i=0;
    while ( pStr[i].GetLen() >0)
    {
            char *p = pStr[i].ConvertToCharArray();
            lst.Add(p);
            delete p;
            i++;
    }
    lst.Sort();
    
    for (int i=0; i

你可能感兴趣的:(算法)