对大家有帮助的问答会被标记为“推荐”,看完课程过来浏览一下别人提的问题,会帮你学得更全面
int a[9] = {9,7,2,5,3,6,1,4,8}; int m = a[0]; for(int i=1; i<9; i++){ if(a[i]>m) m = a[i]; } cout << m << endl;
这里面a【0】代表什么?
#include<iostream> using namespace std; int main() { int a = 5, b = 8; int c; c = a - b; if(c<0){ int diff = c + 12; } cout << diff << endl; return 0; }
算5月到明年8月共有多少个月,这段代码哪里错了诶
#include <iostream> using namespace std; int main() { cout<<"Hello world"<<endl; renturn 0; }
哪里不对啊
分解质因数
90 = 2 x 3 x 3 x 5
设计思路:
1for(i 从 2 到 n-1){2 if(n 能除开 i){3 输出 i4 n = n / i5 设法阻止 i 的自增行为6 }7}8if(剩下的 n > 1) 输出 n;
如何设计程序
for(int j=1; j<=9; j++){ 2 for(int i=1; i<=j; i++){ 3 int k = i * j; 4 cout << j << "x" << i << "=" << k << " "; 5 } 6 cout << endl; 7}
为什么去掉cout << endl后排列就不整齐了
for(int j=1; j<=9; j++){ 2 for(int i=1; i<=j; i++){ 3 int k = i * j; 4 cout << j << "x" << i << "=" << k << " "; 5 } 6 cout << endl; 7}
这个99乘法表里输出运行时的直角三角形是如何形成的
int a = 5, b = 8; int x = 100; if(a>10 && (x=b)){ cout << "here" << endl; } cout << x << endl;
为什么x=b要打括号,a>10不打括号
为什么用ULL代替unsigned long long后,std::numeric_limits<类型>::max()中的类型把后面的int也给等价掉了