#include <iostream> int main() { int num = 0; double data; for (int i = 0; i<6; i++) { scanf("%lf", &data); if (data > 0) { num++; } } printf("%d positive numbers\n", num); return 0; }
定义 data是double 为啥输入会有整数
用iostream没有using namespace可以运行么?
要使用 cin cout 才加 using namespace std;
这个我知道,那下面的语句其实是没用到iostream是吧?
没用到
定义 data是double 为啥输入会有整数
用iostream没有using namespace可以运行么?
要使用 cin cout 才加 using namespace std;
这个我知道,那下面的语句其实是没用到iostream是吧?
没用到