C++语言开发示例:15. 并且
and.cpp
#include <iostream>
const int ArSize = 6;
int main()
{
using namespace std;
float naaq[ArSize];
cout << "Enter the NAAQs (New Age Awareness Quotients) "
<< "of\nyour neighbors. Program terminates "
<< "when you make\n"
<< ArSize << " entries "
<< "or enter a negative value.\n";
int i = 0;
float temp;
cout << "First value: ";
cin >> temp;
while (i < ArSize && temp >= 0)
{
naaq[i] = temp;
++i;
if (i < ArSize)
{
cout << "Next value: ";
cin >> temp;
}
}
if (i == 0)
{
cout << "No data--bye\n";
}
else
{
cout << "Enter your NAAQ: ";
float you;
cin >> you;
int count = 0;
for (int j = 0; j < i; j++)
{
if (naaq[j] > you)
{
++count;
}
}
cout << count;
cout << " of your neighbors have greater awareness of\n"
<< "the New Age that you do.\n";
}
} 最后更新于1年前
本文由人工编写,AI优化,转载请注明原文地址: C++语言开发示例:15. 并且
推荐阅读
C++语言开发示例
1032024-12-27
VMware Workstation 17许可证密钥及免费激活方法详解
36442025-10-26
使用Cesium.js加载vtu格式(UnstructuredGrid)的文件
222025-12-06
深信服VPN客户端下载:EasyConnect与aTrust零信任访问指南
18462025-10-17
Windows系统PyTorch安装教程:CUDA 12.1环境配置与TorchText版本兼容性指南
24482025-10-08
IntelliJ IDEA常见问题解决方案大全:服务面板、Maven报错、启动故障处理
3472026-04-14