Home > Back-end >  Why don't compile successfully run out
Why don't compile successfully run out

Time:02-25

# include
# include
# include
# include
# include
# define Max 100
using namespace std;

Char * PM [10].//paper rank
Int papergrade [10]={0};//paper credits attribute
Int papernum [10]={0};//records of each paper ranks number

Char * cm [100].//the game name
Char * cgrade [100].//record award level
Int comnum [10]={0};//record number of winning every game
Int comgrade [100]={0};//record for each game credits



Void attribute ()//attributes input
{
Int n=3, j, k=0, I=0;
Char c;
Cout<& lt;" Please choose to modify the properties of scientific and technological achievements (paper P, C) competition ";
Cin> c;//the attribute name
If (c=='P')
{
Cout<& lt;" Please enter the thesis level number: ";
Cin> k; Papergrade [0]=k;
Cout<& lt;" Please enter the paper grades and the corresponding study score: ";
for(int j=1; J<=k; J++)
{
Cin> PM [j] & gt;> Papergrade [j];
}

}
If (c=='c')
{
Cout<& lt;" Please enter the race type number: ";
Cin> i; Comgrade [0]=I;
Cout<& lt;" Please enter the competition level and the corresponding study score: ";
for(int j=1; J<=I; J++)
{
Cin> Cgrade [j] & gt;> Comgrade [j];
}
}
}

Void the show ()
{
Cout<& lt;" Theory of article "level, such as, & lt; for(int i=1; i<=papergrade [0]; I++)
{
Cout}
Cout<& lt;" Race said learning points "& lt; for(int j=1; J<=comgrade [0]; J++)
{
Cout}
}


Void initpaperarray ()
{
Int num=0;
The FILE * fp=fopen (" paperarry. TXT ", "rb");
if(! Fp)
{
Cout<& lt;" Unable to open file "& lt; }
The fscanf (fp, "% d", & amp; Num);
Papergrade [0]=num;
for(int i=1; ! The feof (fp); I++)
{
The fscanf (fp, "% s % d", PM [I], & amp; Papergrade [I]);
}
fclose(fp);
}

Void initcomarray ()
{

The FILE * fp=fopen (" comarry. TXT ", "rb");
if(! Fp)
{
Cout<& lt;" Unable to open file "& lt; }
The fscanf (fp, "% d", & amp; Comgrade [0]);
for(int i=1; i<=comgrade [0]; I++)
{
Fscanf (fp, "% s % d", cgrade [I], & amp; Comgrade [I]);
}
fclose(fp);
}



Void savepaperarry ()
{
Fprintf (stdout, "% d", papergrade [0]).
for(int i=1; i<=papergrade [0]; I++)
{
Fprintf (stdout, "% s % d", PM [I], papergrade [I]);
}
}

Void savecomarray ()
{
Fprintf (stdout, "% d", comgrade [0]).
for(int i=1; i<=comgrade [0]; I++)
{
Fprintf (stdout, "% s % d", cgrade [I], comgrade [I]);
}
}



Int main ()
{
Initcomarray ();
Initpaperarray ();
The attribute ();
Show ();

Savecomarray ();
Savepaperarry ();
}
  • Related