📄 record.cpp
字号:
#include "Stash.h"
#include "Stash.cpp"
#include <iostream>
#include <string>
using namespace std;
#define MAXN 1000
#define MAXL 80
int main()
{
Stash name[MAXN],score[MAXN];
int k,n,tmp;
float GPA[MAXN];
char* cp;
string s;
n=0;
while(1)
{
cout<<"NAME(end by END):";
cin>>s;
if(s=="END")
{
break;
}
name[++n].initialize(sizeof(char)*MAXL);
score[n].initialize(sizeof(int));
name[n].add((void *)s.c_str());
cout<<"SCORE(end by -1):";
cin>>tmp;
GPA[n]=0;
while(tmp!=-1)
{
score[n].add(&tmp);
GPA[n]+=tmp;
cin>>tmp;
}
}
for(tmp=1;tmp<=n;tmp++)
{
cout<<"No."<<tmp<<endl<<"NAME:";
k=0;
while((cp=(char *)name[tmp].fetch(k++))!=0)
{
cout<<cp;
}
cout<<endl;
name[tmp].cleanup();
cout<<"SCORE:";
for(k=0;k<score[tmp].count();k++)
{
cout<<*(int *)score[tmp].fetch(k)<<" ";
}
cout<<"GPA:"<<(float)GPA[tmp]/(float)score[tmp].count();
cout<<endl;
}
cin>>n;
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -