gpt4 book ai didi

c++ - 如何显示用户输入的次数以及用户输入的时间

转载 作者:行者123 更新时间:2023-11-28 00:40:12 26 4
gpt4 key购买 nike

<分区>

好的,这个程序在处理循环时似乎很容易,但是如果 else if 和 else 是否可以在这些条件下执行呢?我已经尝试过了,这是我的努力,但我完全失败了。

#include<iostream>
#include<conio.h>
int main(){
using namespace std;
int a,b,c,d,e,f,g,h,j,k,l;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
cout<<"please enter first number\n";
cin>>a;
cout<<"please enter second number\n";
cin>>b;
cout<<"please enter third number\n";
cin>>c;
cout<<"please enter fourth number\n";
cin>>d;
cout<<"please enter fifth number\n";
cin>>e;
cout<<"please enter sixth number\n";
cin>>f;
cout<<"please enter seventh number\n";
cin>>g;
cout<<"please enter eighth number\n";
cin>>h;
cout<<"please enter ninth number\n";
cin>>j;
cout<<"please enter tenth number\n";
cin>>k;
cout<<"please enter eleventh number\n";
cin>>l;
if(a==1)
{
c1=a+1;

}
else if (a==1 && b==1)
{
c2=a+b;
}
else if (a==1 && b==1 && c==1)
{
c3=a+b+c;
}
else if (a==4)
{
c4=a+1;
}
cout<<"no of 1's="<<c1;
getch();
}

我正在取值,取值后我想显示 1 出现了多少时间

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com