帮忙编程
1. 帮忙编程
2.
a = 4, b = 1, c = 9
a = 5, b = 1, c = 8
a = 6, b = 1, c = 7
a = 7, b = 1, c = 6
a = 8, b = 1, c = 5
a = 9, b = 1, c = 4
Press any key to continue
#include<stdio.h>
main()
{
for (int a = 0; a < 10; a++)
for (int b = 0; b < 10; b++)
for (int c = 0; c < 10; c++)
if (a * 101 + 20 * b + 101 * c == 1333)
printf("a = %d, b = %d, c = %d\n", a, b, c);
}
2. 帮忙编程(c语言)
求a&&b,a||b,a&&c 结果是1。
用d=a&&b,a||b,a&&c与e=a&&b;结果一样,都只计算a&&b,对d等式,后面a||b与a&&c没计算(我用VC6.0调试的)。
如果a=12,b=0,c=12;
d=a&&b,a||b,a&&c;d结果为0,若d=a&&c,a||b,a&&b;d结果为1。
#include<stdio.h>
int main() {
int a,b,c,d;
a=12;
b=18;
c=12;
d=a&&b,a||b,a&&c;
printf("%d\n",d);
return 0;
}
3. 帮忙编程,用C语言编。
1.
32, 29
Press any key to continue
#include<stdio.h>
main()
{
for (int i = 30; i < 40; i++)
for (int j = 20; j < 30; j++)
if (i * i + j == 1053 && i + j * j == 873)
printf("%d, %d\n", i, j);
}
2.
#include<stdio.h>
f(int a[], int n)
{
int m = 0, s = 1, i;
for (i = 0; i < n; i++)
{
s *= a[i];
if (a[i] > m)
m = a[i];
}
for (; m <= s; m++)
{
for (i = 0; i < n; i++)
if (m % a[i])
break;
if (i == n)
return m;
}
}
main()
{
int a[] = {9, 18, 27, 3};
cout<<f(a, 4)<<endl;
}
4. 帮忙编程啊
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
double lirun;
cout<<"请输入当月利润:"<<flush;
cin>>lirun;
if(lirun<=100000) {
cout<<"应发放奖金总数:"<<lirun*0.1<<endl;
}else if(lirun<=200000){
cout<<"应发放奖金总数:"<<100000*0.1+(lirun-100000)*0.075<<endl;
}else if(lirun<=400000){
cout<<"应发放奖金总数:"<<100000*0.1+100000*0.075+(lirun-200000)*0.05<<endl;
}else if(lirun<=600000){
cout<<"应发放奖金总数:"<<100000*0.1+100000*0.075+200000*0.05+(lirun-400000)*0.03<<endl;
}else if(lirun<=1000000){
cout<<"应发放奖金总数:"<<100000*0.1+100000*0.075+200000*0.05+200000*0.03+(lirun-600000)*0.015<<endl;
}else{
cout<<"应发放奖金总数:"<<100000*0.1+100000*0.075+200000*0.05+200000*0.03+400000*0.015+(lirun-1000000)*0.01<<endl;
}
system("pause");
return 0;
}
//不知道你是不是这个意思……
5. 帮忙编程,急
做了个简单的程序,看看
'添加窗体Form1,卷标Label1,按钮Command1,Command2,然后添加如下代码:
PrivateTypeMAN
strIDAsString
strAgeAsString
EndType
Dimm1(1To5)AsMAN
PrivateSubForm_Load()
Command1.Caption="信息录入"
Command2.Caption="年龄查询"
EndSub
PrivateSubCommand1_Click()
DimiAsInteger
Fori=1To5
m1(i).strAge=InputBox("请输入第"&i&"人的年龄:","输入年龄")
Next
Fori=1To5
m1(i).strID=InputBox("请输入第"&i&"人的编号:","输入编号")
Next
Command1.Enabled=False
EndSub
PrivateSubCommand2_Click()
DimiAsInteger
Dimstr1AsString
str1=InputBox("请输入你要查看的人的编号:","输入编号")
Fori=1To5
Ifm1(i).strID=str1Then
Label1.Caption=m1(i).strAge
ExitSub
EndIf
Next
Ifi=6Then
MsgBox"输入的编号有误!"
Label1.Caption="编号有误"
EndIf
EndSub
6. 帮忙编程一下
public class Demo2 {
public static void main(String[] args) {
long a=1L;
for (int i = 0; i <18 ; i++) {
a*=10;
}
System.out.println(a);
long d;
long b=a-1;
long c;
long e=1L;
do{
c=b-1;
d=b+c;
b--;
e++;
}while(d>a);
System.out.println(e);
}
}
这是java中的代码示例,对不起c++我不懂,思路希望你能看懂
其实答案就是(10^18)/2 -1=5*10^17-1
两短边之和小于第三边就构不成三角形了
代码可以直接修改成下面的,上边的代码是一个一个试呢,效率太低
7. 求大神帮忙c语言编程
#include <iostream.h>
int main()
{
int weight = 0;
float money = 0;
printf("请输入托运行李重量");
scanf("%d",&weight);
if(weight <= 20)
{
printf("免费托运");
}
if(weight>20 && weight<=30)
{
money = (weight-20)*30;
printf("超出20公斤的部分30元/公斤,托运费用为:,%f\n",money,"元");
}
if(weight>30 && weight<=40)
{
money = 10*30+(weight-30)*40;
printf("超出30公斤的部分40元/公斤,托运费用为:,%f\n",money,"元");
}
if(weight>40 && weight<=50)
{
money = 10*30+10*40+(weight-40)*50;
printf("超出40公斤的部分50元/公斤,托运费用为:,%f\n",money,"元");
}
if(weight>50)
{
printf("超出允许范围,不允许携带\n");
}
return 0;
}
8. 编程,想请大家帮帮忙
#include <stdio.h>
void main()
{
int month,day;
printf("请输入月份:");
scanf("%d",&month);
if(month==4)
{
printf("这个月有年会活动 ");
printf("请输入日期:");
scanf("%d",&day);
if(day<12)
printf("年会尚未举办 ");
else if(day==12)
printf("年会今日举办 ");
else
printf("年会已经举办 ");
}
else
printf("这个月没有年会 ");
}
9. 帮忙编程!!
倒序输出:iamahandsomeboy
#include<stdio.h>
main()
{
int i,array[15];
for(i=0;i<15;i++)
{scanf("%c",&array[i]);}
for(i=14;i>=0;i--)
{printf("%c ",array[i]);}
printf("\n");
}
在VC 6.0上运行