当前位置:首页 » 编程软件 » 编程问题囊

编程问题囊

发布时间: 2022-04-17 12:00:20

① 简单编程问题

#include <stdio.h>

int main()

{

int x,y;

x=3;

y=x*x;

printf("%d = %d * %d ", y,x,x);

printf("%d * %d = %d ", x,x,y);// 输出

return 0;

}

c语言编程问题(急)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct student
{
char name[10];
char number[10];
int b[3];
};
int average(struct student *p)
{
int i;
for(i=0;i<=9;i++)
printf("average is%4d\n",((p+i)->b[0]+(p+i)->b[1]+(p+i)->b[2])/3);
}
int highest(struct student *p)
{
int i,j,high=0;//这里要声明一下'j'你没有声明
float avg;//平均值要用除法,最好是浮点型。
avg=(p->b[0]+p->b[1]+p->b[2])/3;
for(i=0;i<=9;i++)
{
if(avg<((p+i)->b[0]+(p+i)->b[1]+(p+i)->b[2])/3)
{
avg=((p+i)->b[0]+(p+i)->b[1]+(p+i)->b[2])/3;
j=i;
}
}
printf("%4s %4s %4f %4d %4d %4d\n",p[j].name,p[j].number,avg,p[j].b[0],p[j].b[1],p[j].b[2]);
//注意这里的输出格式控制,name, number都是字符数组,不应该为%d,不然输出来让人看不懂
}
int main()
{
struct student a[10];
int i;
for(i=0;i<10;i++)//这里只有10个值,注意边界,还有数组的起始下标为0
{
printf("input name number\n");
scanf("%s %s",&a[i].name,&a[i].number);
printf("input 1 2 3\n");
scanf("%d %d %d",&a[i].b[0],&a[i].b[1],&a[i].b[2]);
}
highest(a);
average(a);
}
你的思维逻辑是正确的,只是编程风格实在不好。

③ 简单的编程问题

回答:

问题1:

int fact(int n) //for语句
{
int i,TempInt=1;
for(i=2;i<=n;i++)
TempInt*=i;
return TempInt;
}
int fact(int n) //while语句
{
int i=2,TempInt=1;
while(i<=n)
{
TempInt*=i++;
}
return TempInt;
}

问题2
int max(int a,int b,int c)
{
int d=a;
if(d<b) d=b;
if(d<c) d=c;
return d;
}
int min(int a,int b,int c)
{
int d=a;
if(d>b) d=b;
if(d>c) d=c;
return d;
}

问题3.2

float pow(float a,int n)
{
int i,tn;
float tp=1;
if(n<0)
{
for(i=1;i<=-n;i++)
tp*=a;
if(tp!=0) return 1/tp;
}
if(n>0)
{
for(i=1;i<=n;i++)
tp*=a;
return tp;
}
return 1;
}

④ 编程的问题

C语言也就是编程的基础!只要学好C就OK!以后学习其他语言也很简单!其实都和C也是大同小异!
学习编程就从C学起!掌握好C语言的重点:数据类型,控制语句,指针,结构体等(我建议学点英语会更好)这样对你编程也有很大的帮助!
没英语基础学起来有些知识点不是那么好记忆~~~~···(我是学软件开发的,学了一年多了·这是我的的总结)

祝你成功!!!

⑤ 关于编程问题

你在结束前加一个readln语句。就会等你打了一个回车后再回到编程界面:
Program lx;
var r,c,y:integer;
begin
writeln('请输入密码');
write('r=');
readln(r);
write('c=');
readln(c);
write('y=');
readln(y);
if (r=1998)and(c=09)and(y=17) then write('欢迎')
else write('r=1998,c=09,y=17');
readln;
end.

⑥ 关于编程的问题!

VB 非常齐全的资料

手册与指南

VB.Net与ASP.Net代码手册
http://download.chinaitlab.com/soft/10468.htm

VB 6.0中文版语言参考手册
http://download.chinaitlab.com/soft/10467.htm

VB编程经验手册
http://download.chinaitlab.com/soft/9412.htm

VB API 函数使用手册
http://download.chinaitlab.com/soft/9308.htm

VBA高级开发手册
http://download.chinaitlab.com/soft/9307.htm
VB速查手册之技巧篇
http://download.chinaitlab.com/soft/9306.htm
VB与VBA技术手册
http://download.chinaitlab.com/soft/9305.htm
VB.NET Remoting 技术手册
http://download.chinaitlab.com/soft/9146.htm
VB.Net调试技术手册
http://download.chinaitlab.com/soft/9145.htm
VB.Net字符串和正则表达式参考手册
http://download.chinaitlab.com/soft/9137.htm
VBScript语言参考
http://download.chinaitlab.com/soft/7915.htm
VB6程序设计参考手册
http://download.chinaitlab.com/soft/7599.htm
VB技巧问答10000例
http://download.chinaitlab.com/soft/6694.htm
VB5 开发WEB数据库指南
http://download.chinaitlab.com/soft/6181.htm
VBscript英文帮助手册
http://download.chinaitlab.com/soft/5950.htm
VB6控件参考手册
http://download.chinaitlab.com/soft/5946.htm
VB6语言参考手册
http://download.chinaitlab.com/soft/5947.htm
VB6程序员指南
http://download.chinaitlab.com/soft/5944.htm
VB 5开发WEB数据库指南
http://download.chinaitlab.com/soft/4702.htm
VBA 高级开发指南
http://download.chinaitlab.com/soft/4604.htm
VB中文版实用参考手册
http://download.chinaitlab.com/soft/3682.htm
VB编程经验手册
http://download.chinaitlab.com/soft/2161.htm
VB6组件工具指南
http://download.chinaitlab.com/soft/1752.htm
Visual Basic API函数参考手册
http://download.chinaitlab.com/soft/9843.htm
Visual Basic 6.0中文版实用参考手册
http://download.chinaitlab.com/soft/9398.htm
Vsual Basic 6.0 控件参考手册
http://download.chinaitlab.com/soft/9288.htm
Visual Basic.NET 串行化参考手册
http://download.chinaitlab.com/soft/9241.htm
Visual Basic.net 反射参考手册
http://download.chinaitlab.com/soft/9240.htm
Visual Basic.NET类设计手册
http://download.chinaitlab.com/soft/9235.htm
Visual Basic.net线程参考手册
http://download.chinaitlab.com/soft/9126.htm
Visual Basic编程经验手册
http://download.chinaitlab.com/soft/7975.htm
Visual Basic.Net专家指南
http://download.chinaitlab.com/soft/10311.htm
Visual Basic.NET编程指南
http://download.chinaitlab.com/soft/9841.htm
Visual Basic 6.0 组件工具指南
http://download.chinaitlab.com/soft/7602.htm

其它相关资源
VBSCRIPT函数方法速查
http://download.chinaitlab.com/soft/6158.htm
VBScript学习
http://download.chinaitlab.com/soft/5949.htm
VB学习一点通 V1.0
http://download.chinaitlab.com/soft/5762.htm
Access 2003 VBA 程序员参考书
http://download.chinaitlab.com/soft/5293.htm
VB、C快速进阶 V3.0
http://download.chinaitlab.com/soft/4735.htm
VB系统资源
http://download.chinaitlab.com/soft/4701.htm
VB Script语言参考
http://download.chinaitlab.com/soft/4451.htm
VB编程技巧集
http://download.chinaitlab.com/soft/3882.htm
VBScript 教程及语言参考
http://download.chinaitlab.com/soft/3881.htm
VBScript与JScript实例教程
http://download.chinaitlab.com/soft/2639.htm
VB Script基础
http://download.chinaitlab.com/soft/2160.htm
VBScript 帮助手册
http://download.chinaitlab.com/soft/2135.htm
VB常用函数
http://download.chinaitlab.com/soft/1753.htm
VB精华文摘
http://download.chinaitlab.com/soft/1269.htm
Visual Basic 术语解释
http://download.chinaitlab.com/soft/10677.htm
Visual Basic 常用数值算法
http://download.chinaitlab.com/soft/9301.htm
Visual Basic 第三方控件大全
http://download.chinaitlab.com/soft/9300.htm
Visual Basic 语言参考-函数速查
http://download.chinaitlab.com/soft/6244.htm

视频相关:
VB.net多媒体教学
http://download.chinaitlab.com/soft/1567.htm
洪恩编程之道VB.NET
http://download.chinaitlab.com/soft/9559.htm
编程高手教程-VB
http://download.chinaitlab.com/soft/9180.htm
边用边学Visual Basic 6视频教学
http://download.chinaitlab.com/search.asp?keywords=边用边学Visual%20Basic%206视频教学&tt=3
程序设计基础视频教学
http://download.chinaitlab.com/search.asp?keywords=VB程序设计基础视频教学&tt=3
VB编程与应用视频
http://download.chinaitlab.com/search.asp?keywords=VB编程与应用视频&tt=3
VB.net 英文视频教程
http://download.chinaitlab.com/search.asp?keywords=VB.net%20英文视频教程&tt=3

⑦ 编程问题

让我小松鼠来告诉你吧。
Option Base 1
我们知道,在VB中的数组不管是一维,二维还是三维,其默认的数组下界都为0。举例来说,下面语句
Dim MyArray(2) AS Integer
声明了一个名称为MyArray的数组,类型为Integer,共有3个元素,这3个元素的下标范围为0-2(默认下标下界从0开始)。就是说,MyArray数组的3个元素下标依次为MyArray(0),MyArray(1),MyArray(2)。可以看到,这种默认数组下标下界从0开始的方式很不符合人们的习惯。
为了使数组的使用符合人们的习惯,可以加入Option Base 1 语句告诉VB所定义的数组的下标下界从1开始而不是使用默认的从0开始。这样,对上面MyArray数组的定义语句,
则应改为
Dim MyArray(3) AS Integer
这样MyArray数组的下标范围就变成了1-3,MyArray数组的3个元素下标依次为MyArray(1),MyArray(2),MyArray(3)。这时如果仍用MyArray(0)来访问MyArray数组的第一个元素,运行时将发生下标越界的实时错误。

Option Explicit
在缺省情况下,VB并不要求在使用变量时一定要先声明该变量,这样做看起来很方便,变量不用声明就可以用来用去,但却存在潜在的危险。例如我们使用了一个名为ABCD的变量来保存一个将要使用的值,而在要使用该变量的值的地方我们误将ABCD变量名输入成ABC,这时系统在不经任何提示的情况下会认为又出现了一个新变量。这种错误一旦发生,将很难检查出来。对变量不加声明就使用,是一种极为糟糕的编程方法。
加入Option Explicit语句后,系统就会要求在程序中使用的任何变量都必须先声明。如果在程序中使用了未经声明的变量,在程序运行后会弹出消息框提醒程序编写者。

怎么样,你理解了吗。

⑧ 初学编程的人一般会遇到的几个问题

对于一个初学编程的人来说,首先遇到的问题就是:(1)、在编写源程序过程中出现的各种语法错误。这种错误主要是由于刚刚开始学习编程,对编程语言的语句、以及语法结构还不是很清晰造成的,这种错误是最容易进行调试的,因为语法错误,编译器连编译都无法通过;(2)、当对初始编程较为熟练了、且语法错误较少了之后,之后就会遇到更为复杂、并且难于调试的语义错误。例如在 C 语言中,对于如下代码:
void main( )
{
int n ;
scanf("%d", &n) ;
if( n == 100)
printf(" n is 100 !\n") ;
else
printf(" n is not 100 !\n") ;
}
在逻辑判断语句:if( n == 100) 中,如果误将“==”(逻辑等于)写成了“=”(赋值等于),那么在 scanf("%d", &n) 语句中,无论你输入的 n 等于多少,一旦执行 if 语句,那么 将 100 这个数字赋给变量 n,则该逻辑表达式的值总是 1,程序的运行结果必定总是输出:n is 100。
而该程序的实际思路是:从键盘输入一个整数,如果该整数等于 100,则输出:n is 100 !
如果输入的整数不等于 100 的话,则输出:n is not 100 !
像这样的逻辑错误(在编译源程序时,C 语言编译器是检查不出来的),如果没有丰富的程序调试经验,程序调试起来就是非常困难的。
所以说,如果想学习编程,必须要勤于上机编辑、调试、运行程序,而不能够只是在书本上阅读程序。只有这样,才能够在较短的时间内,使自己的编程水平有一个较大的提高。

热点内容
虚荣安卓怎么充值 发布:2025-03-19 01:12:27 浏览:889
如何更改报考密码 发布:2025-03-19 01:08:12 浏览:415
python日期类型 发布:2025-03-19 01:02:28 浏览:414
android飞机大战源码 发布:2025-03-19 00:56:52 浏览:736
javaset方法 发布:2025-03-19 00:44:21 浏览:246
淘宝上传文件夹 发布:2025-03-19 00:36:30 浏览:73
oracle数据库备份数据 发布:2025-03-19 00:35:04 浏览:547
蚕丝算法 发布:2025-03-19 00:34:16 浏览:660
录制测试脚本 发布:2025-03-19 00:33:33 浏览:376
x3000r存储卡 发布:2025-03-19 00:12:22 浏览:221