打字测试

· · 个人记录

#include<bits/stdc++.h>
using namespace std;
string s1="yourrideisheregreedygiftgiversfridaythethirteenthbrokennecklacemilkingcowstransformationsnamethatnumberpalindromicsquaresdualpalindromesmixingmilkbarnrepaircalfflacprimecryptarithmcombinationlockpackingrectanglesarithmeticprogressionsmothersmilknumbertrianglesprimepalindromessuperprimeribcheckerchallengethecastleorderedfractionssortingathreevaluedsequencehealthyholsteinshammingcodesprefacenumberingsubsetsumsrunaroundnumberspartylampslongestprefixcowpedigreeszerosumcontrollingcompaniesconcommoneysystemsthetamworthtwooverfencingcowtoursbessiecomehomefractionstodecimalsagrinetscoreinflationhumblenumbersshapingregionscontactstampsfactorialsstringsobitsspinningwheels";
string s2="feedratiosmagicwquaressweetbutterridingthefencesshoppingofferscamelothomeontherangeagameclosedfencesamericanferitageelectricfencerausousrockersbeefmcnuggetsfencerailsfenceloopscryptcowgraphydrainageditchestheperfectstalljobprocessingcowcyclesbuylowbuylowertheprimesstreetracelettergameshuttlepuzzlepollutantcontrolframeupfencingthecowsstarrynightmusicalthemessnailtrailswisconsinsquaremilkmeasuringwindowareanetworkofschoolsbigbarnalllatinsquarescanadatourcharacterrecognitiontelecowmunicationpicturehiddenpasswordtwofivemilkpumpinggcowdatemooriokartmowingredistrictingexercise";
string s3="poetryshortcutsleepyspjdiningcowpatibilityteamworkgatheringbalanceitouttalentshowmilkingorderoutofsortsdisruptionoutofsortstraintrackingtamingtheherddirectorytraversalsnowbootscowgymnastsnewbarnsslingshotstamppaintingcowatlargenootubesprinklerscowatlargelifeguardshaybalefeastbarnpaintingapieforapiegreedygifttakerspushaboxstandingoutfromtheherdcownavigationhoofpaperscissorsbalancedphotomodernartbovinegenomicswhydidthecowcrosstheroadwhydidthecowcrosstheroadbuildingatallbarnsubsequencereversalpromotioncountingcoubasicwhydidthecowcrosstheroadswitchgrasswhydidthecowcrosstheroadmodernart";

int main(){
    string s;
    int sum=0;
    int tim=time(0);
    cout<<"按任意键开始,选择文章(1~3)";
    int t;
    cin>>t;
    string s0;
    if(t==1) s0=s1;
    if(t==2) s0=s2;
    if(t==3) s0=s3;
    while(1)
    {
        system("cls");
        srand(time(0));
        int t2=time(0);
        cout<<"打字速度:"<<sum*60/(t2-tim+1)<<"个/分"<<endl; 
        for(int i=0;i<=30;i++)
        cout<<s0[i];
        cout<<endl;
        cin>>s;
        for(;s!="";)
        {
            if(s[0]==s0[0])
            {
                sum++;s.erase(0,1);s0.erase(0,1);
            }
            else break;
        }
    }

    return 0;
}