一道练习题
求解啊!!!
怎么做怎么做 #include<iostream>
using namespace std;
int main()
{
int i,j,k,h,s;
int a;
for(i=123;i*3<=987;i++)
{
for(h=1;h<10;h++)
a=0;
a=1;
a=1;
a=1;
j=i*2;
a=1;
a=1;
a=1;
k=i*3;
a=1;
a=1;
a=1;
for(s=0,h=1;h<10;h++)
s=s+a;
if(s==9)
cout<<"i="<<i<<" j="<<j<<" k="<<k<<endl;
}
return 0;
} 本帖最后由 jitianmoshen 于 2020-11-20 15:57 编辑
#include <stdio.h>
#include <stdbool.h>
int main(void)
{
int n1,n2,n3,i;
bool flag = false;
for (n1 = 123;n1 * 3 < 987;n1++)
{
flag= true;
int count = {0};
n2 = n1 * 2;
n3 = n1 * 3;
count++;
count++;
count++;
count++;
count++;
count++;
count++;
count++;
count++;
for (i = 1;i < 10;i++)
{
if (count > 0 || count == 0) //如果有数字0或者1-9有数字未使用
{
flag= false;
break;
}
}
if (!flag)
continue;
else
printf("%5d %5d %5d\n",n1,n2,n3);
}
return 0;
} homework1.c: In function ‘countLines’:
homework1.c:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
homework1.c:22: error: ‘fp’ undeclared (first use in this function)
homework1.c:22: error: (Each undeclared identifier is reported only once
homework1.c:22: error: for each function it appears in.)
homework1.c:22: error: ‘filename’ undeclared (first use in this function)
homework1.c:24:18: warning: missing terminating " character
homework1.c:24: error: missing terminating " character
homework1.c:25: error: expected expression before ‘return’
homework1.c:26: error: expected ‘;’ before ‘}’ token
homework1.c:30:14: warning: missing terminating ' character
homework1.c:30: error: missing terminating ' character
homework1.c:31: error: expected expression before ‘{’ token
homework1.c:34: error: expected expression before ‘}’ token
homework1.c: In function ‘findAllDirs’:
homework1.c:63: warning: assignment makes pointer from integer without a cast
我已经检查很多次,错在哪里 谢谢大家
页:
[1]