P.s__葬爱 发表于 2014-8-10 10:14:16

大神给看看代码

本帖最后由 P.s__葬爱 于 2014-8-10 10:38 编辑


#include<iostream>
using namespace std;
int main()
{
const char KEY[]={'a','c','a','d','c'};
char c;//char
int i=0,j=0;
cout<<"Enter the 5 question test"<<endl;
while(cin.get(c));
{
if(c!='\n')//'\n'
{
   if(c==KEY)
   {
    cout<<" ";
    j++;
   }
   else cout<<"*";
i++;
}
else cout<<"Score"<<static_cast<float>(j)/i*100<<"%"<<endl;
}
return 0;
}
为啥没法循环啊
页: [1]
查看完整版本: 大神给看看代码