500 C样本程序 [英] 500 C sample Programs

查看:55
本文介绍了500 C样本程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HiTechSkill.Com提供免费信息,测试和样本采访

有助于提高您的信息技术技能的问题。
http://www.hitechskill.com

解决方案

< blockquote> www.hitechskill.com 写道:


HiTechSkill.Com提供免费信息,测试和样本采访
有助于提高您的信息技术技能的问题。
http://www.hitechskill.com




500 C示例程序!让更正开始吧!


/ *程序号:1 * /

/ *目的:显示消息* /

/ *书面日期:14/12/2004 * /


#include< stdio.h>


void main()

{

printf("%s",欢迎来到c编程);

}

/ ************************* /

1. void main是一个非便携式的主要类型。

这样的代码需要说明它的实现方式。

2. main,用空括号定义

是一个过时的该语言的特色。

3.一个不以换行符结尾的文本流

是不可移植的,而printf是%s,

是一种略微过度卷积的输出方式

a特定的字符串文字。

4.没有返回语句,这在C99中是允许的,

但不是C89。


/ *程序号:2 * /

double radius = 0.0,area;

printf("%lf",area);


1.所有相同的问题如程序编号1和更多。

2%lf在C99中被允许作为double的格式说明符,

但是正确的printf格式说明符是双倍的

C89和C99,是%f。


/ *程序编号:3 * /

1.所有与程序编号2相同的问题。


跳过所有几乎相同的程序...


/ *程序号:22 * /

/ *目的:读取和打印从上到下* /


printf("%c",任意+32);


1.所有与程序编号1相同的问题加上

2.一个具有上述目的的程序,

真的应该显示如何使用tolower功能。


"基本(50个程序)"是一个糟糕的名字选择,

链接到25个节目的列表。

" While Loops(100个节目)"和For Loops(100个程序)

一遍又一遍地重复所有相同的问题。


此时,我在假设所有程序

至少都有与程序编号1相同的问题。


/ *程序编号:231 * /

getch();


getch不是标准C的一部分而且有一个明显错字

导致没有文件#包括。


这四个链接都是一样的:

功能(50个程序)

指针(100个程序)

文件(100个程序)

Unix命令(25个程序)


-

pete


pete写道:

1. void main是main的非便携类型。
[...] 4.没有退货声明,允许在C99,但不是C89。




甚至关于实现哪些文件''无效''作为有效的返回类型

for main()?


pete写道:< blockquote class =post_quotes> www.hitechskill.com 写道:


HiTechSkill.Com提供免费信息,测试和样本采访
有助于提高您的信息技术技能的问题。
http://www.hitechskill.com



500 C示例程序!让纠正开始吧!

/ *程序号:1 * /
/ *目的:显示消息* /
/ *书面日期:14/12/2004 * /

#include< stdio.h>

void main()
{/> printf("%s","欢迎光临) c编程写作);
}
/ ************************* /

1. main main是一个非便携式的main类型。
这样的代码需要说明它的实现。
2. main,用空括号定义
是一个过时的功能语言。
3.一个不以换行符结尾的文本流
是不可移植的,而带有%s的printf,
是一种略微过度卷积的输出方式
一个特定的字符串litteral。
4.没有返回声明,这是允许在C99,
但不是C89。

/ *程序号:2 * /
double radius = 0.0,area;
printf("%lf",area);

1。所有与程序编号1相同的问题。
在C99中允许2%lf作为double的格式说明符,
C89和C99中的正确printf格式说明符为double ,是%f。

/ *程序编号:3 * /
1.所有与程序编号2相同的问题。

跳过所有几乎相同的节目......

/ *节目编号:22 * /
/ *目的:阅读并打印上下* *

printf(&%; c",any + 32);

1.所有与程序编号1相同的问题加上
2.一个具有这个目的的目的的程序,
真的真的应该展示如何使用tolower功能。

基本(50个程序)是一个糟糕的名字选择,
链接到25个程序的列表。
While循环(100个程序)和For循环(100个程序)
一遍又一遍地重复所有相同的问题。

此时,我假设所有的程序
至少有与程序编号1相同的所有问题。

/ *程序编号:231 * /
getch();

getch不是一部分标准C和一个明显的错误
导致没有文件#included。

这四个链接都是相同的:
函数(50个程序)<指针(100个程序)
文件(100个程序)
Unix命令(25个程序)




我认为他是1 / 1/2005

-

==============

不是学究者

==============


HiTechSkill.Com offers free information, tests, and sample interview
questions that will help to improve your information technology skills.
http://www.hitechskill.com

解决方案

www.hitechskill.com wrote:


HiTechSkill.Com offers free information, tests, and sample interview
questions that will help
to improve your information technology skills.
http://www.hitechskill.com



500 C sample Programs! Let the corrections begin!

/* program no : 1 */
/* purpose : display the message */
/* date of written : 14/12/2004 */

#include <stdio.h>

void main()
{
printf("%s"," welcome to c programming writting");
}
/*************************/

1. void main is a nonportable type for main.
Code like this needs to say what implementation it''s for.
2. main, defined with empty parentheses
is an obsolecent feature of the language.
3. A text stream that doesn''t end in a newline character
is nonportable, and printf with a %s,
is a slightly overconvoluted way of outputting
a that particular string litteral.
4. There''s no return statement, which is allowable in C99,
but not C89.

/* program no : 2 */
double radius=0.0,area;
printf("%lf", area);

1. All the same problems as program number 1 and more.
2 %lf is allowed in C99 as the format specifier for double,
but the right printf format specifier for double in both
C89 and C99, is %f.

/* program no : 3 */
1. All the same problems as program number 2.

Skipping past all the nearly identical programs to ...

/* program no : 22 */
/* purpose : read and print upper to lower */

printf("%c", any+32);

1. All the same problems as program number 1 plus
2. A program that has the stated purpose of this one,
really really should show how to use the tolower function.

"Basic (50 programs)" is a bad choice of names,
for a link to a list of 25 programs.
"While Loops(100 programs)" and "For Loops(100 programs)"
have all the same problems repeated over and over.

At this point, I''m assuming that all the programs
have at least all the same problems as program number 1.

/* program no : 231*/
getch();

getch isn''t part of standard C and there''s an apparent typo
which causes no files to be #included.

These four links are all the same:
Functions (50 programs)
Pointers (100 programs)
Files(100 programs)
Unix Commands(25programs)

--
pete


pete wrote:

1. void main is a nonportable type for main. [...] 4. There''s no return statement, which is allowable in C99,
but not C89.



Even on implementations which document ''void'' as a valid return type
for main() ?


pete wrote:

www.hitechskill.com wrote:


HiTechSkill.Com offers free information, tests, and sample interview
questions that will help
to improve your information technology skills.
http://www.hitechskill.com



500 C sample Programs! Let the corrections begin!

/* program no : 1 */
/* purpose : display the message */
/* date of written : 14/12/2004 */

#include <stdio.h>

void main()
{
printf("%s"," welcome to c programming writting");
}
/*************************/

1. void main is a nonportable type for main.
Code like this needs to say what implementation it''s for.
2. main, defined with empty parentheses
is an obsolecent feature of the language.
3. A text stream that doesn''t end in a newline character
is nonportable, and printf with a %s,
is a slightly overconvoluted way of outputting
a that particular string litteral.
4. There''s no return statement, which is allowable in C99,
but not C89.

/* program no : 2 */
double radius=0.0,area;
printf("%lf", area);

1. All the same problems as program number 1 and more.
2 %lf is allowed in C99 as the format specifier for double,
but the right printf format specifier for double in both
C89 and C99, is %f.

/* program no : 3 */
1. All the same problems as program number 2.

Skipping past all the nearly identical programs to ...

/* program no : 22 */
/* purpose : read and print upper to lower */

printf("%c", any+32);

1. All the same problems as program number 1 plus
2. A program that has the stated purpose of this one,
really really should show how to use the tolower function.

"Basic (50 programs)" is a bad choice of names,
for a link to a list of 25 programs.
"While Loops(100 programs)" and "For Loops(100 programs)"
have all the same problems repeated over and over.

At this point, I''m assuming that all the programs
have at least all the same problems as program number 1.

/* program no : 231*/
getch();

getch isn''t part of standard C and there''s an apparent typo
which causes no files to be #included.

These four links are all the same:
Functions (50 programs)
Pointers (100 programs)
Files(100 programs)
Unix Commands(25programs)



I think he was hungover on 1/1/2005
--
==============
Not a pedant
==============


这篇关于500 C样本程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆