#include using namespace std;

int main() { int n; cout << "请输入一个不多于3位的正整数:"; cin >> n; if (n < 10) { cout << "这是个1位数" << endl; } else if (n < 100) { cout << "这是个2位数" << endl; } else if (n < 1000) { cout << "这是个3位数" << endl; } else { cout << "输入错误!" << endl; } return 0; }

给出一个不多于3位的正整数n要求求出它是几位数if语句并上机实验c++

原文地址: https://www.cveoy.top/t/topic/JtI 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录