实验七

11-3 | 4 | 7

#include 
#include 
#include 
#include 
using namespace std;

int main()
{
    ios_base::fmtflags original_flags=cout.flags();//保存现在的格式化参数的设置
    cout<<812.000<<'|';
    cout.setf(ios_base::left,ios_base::adjustfield);//对齐方式为左对齐
    cout.width(10);//以长度为 10 的格式输出
    cout<<813<<815.0<<'\n';
    cout.unsetf(ios_base::adjustfield);//清除对齐方式
    cout.precision(2);
    cout.setf(ios_base::uppercase|ios_base::scientific);//以科学计数法的格式输出浮点数,显示 E
    cout<<813.0;
    cout.flags(original_flags);//恢复初始参数
    cout<

实验七_第1张图片

call the roll :

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

bool breorcon()
{
    // string a;
    // getline(cin,a);
    if(_kbhit())//找了好久才找到,_kbhit()返回缓存区是否为空,空返回 0 ,非空返回 1
    {
        cin.sync();
        cin.clear();
        return false;
    }
    return true;

}

string generatetime()//利用WindowsAPI获取系统时间
{
    SYSTEMTIME sys;
    GetLocalTime(&sys);
    int pl;
    string m="";
    pl=sys.wYear;   m+=to_string(pl);
    pl=sys.wMonth;  if(pl<10)m+="0";    m+=to_string(pl);
    pl=sys.wDay;    if(pl<10)m+="0";    m+=to_string(pl);
    pl=sys.wHour;   if(pl<10)m+="0";    m+=to_string(pl);
    pl=sys.wMinute; if(pl<10)m+="0";    m+=to_string(pl);
    pl=sys.wSecond; if(pl<10)m+="0";    m+=to_string(pl);
    return m;
}


void scanfileall(string n)//一次性读取文件并输出(这个程序没用到)
{
    string s;
    ifstream in(n);
    ostringstream tmp;
    tmp<> list,rolist;


    string base="roll_";
    base+=generatetime();
    base+=".txt";
    ifstream input(trollfile);
    ofstream output(base);
    if(output)
        cout<<"Create data file successfully."<());
            for(int k=0;k<4;k++)
            {
                list[a].push_back(string());
                scin>>list[a][k];
            }
            a++;
        }
    }
    input.close();
    int rolljudge[a+1]={0};



    cout<<"Press any key to stop."<());
            for(int j=0;j<4;j++)
            {
                rolist[rollnum].push_back(list[k][j]);
                cout<>classname;
        roll(classname);
    }
    return 0;
}

实验七_第2张图片

Collection :

#include 
#include 
#include 
#include 
#include 
using namespace std;


void scanall(string n,int *p)
{
    string k,s,a;
    n+=".txt";
    ifstream in(n);
    ostringstream tmp;
    tmp<>a)
        {
            p[1]++;
            p[0]+=a.size();
        }
    }
}
int main()
{
    string n,j,pin;
    while(1)
    {
        cout<<"Enter the name of the file: "<>n;
        int num[3]={0};
        scanall(n,num);
        cout<<"Please input the name of the thing you want to know ,"<>j)
        {
            if(j=="letters")
                cout<<"Number of letters : "<

实验七_第3张图片

你可能感兴趣的:(实验七)