关于计算机系统的问题

A1989050111 2009-05-31 10:33:15
一:Programming with GCC
Edit the source codes with vi/vim, kate, gedit,
or other editors.
Compile the programs with GCC
(1)Write programs
The “Hello world” program: display “Hello
world” on the screen.
(2)Read 10 integer numbers from the
keyboard, output them in descending order.
Print out all the command line parameters
that it receives.

二:Calling system calls
Using system calls, write a program in C/C++
that reads data from one file and copies it to
another file.
System calls that might be needed:
open(), close(), read(), write().
(see the man-pages for reference).
...全文
201 26 打赏 收藏 转发到动态 举报
写回复
用AI写文章
26 条回复
切换为时间正序
请发表友善的回复…
发表回复
lylm 2009-06-01
  • 打赏
  • 举报
回复
1.
(1)编个hello word,用gcc编译
(2)数组从大到小排序,够简单吧
2.跟操作系统有点关系,系统调用
  • 打赏
  • 举报
回复
(1)Write programs
The “Hello world” program: display “Hello
world” on the screen.


无语,这都要问,一句printf而已
Treazy 2009-06-01
  • 打赏
  • 举报
回复
找个编辑器写代码
如果楼主你是使用集成开发环境,我想连编辑器都可以省了
比如VS,Netbean,Eclipse,等

Hello world这样的入门程序应该每本计算机语言书上都会有的吧

文件操作也是比较简单和常用的系统调用

楼主直接baidu,google就一堆了!
huangjintian 2009-06-01
  • 打赏
  • 举报
回复
上网找吧 ~~~O(∩_∩)O~
nosxcy 2009-06-01
  • 打赏
  • 举报
回复
只要有兴趣,再加以恒心,一定会成为高手的,
罗马非一日建成,同理,高手非一日练成.
A1989050111 2009-06-01
  • 打赏
  • 举报
回复
万事入门难,有个好的开始,以后就可以得心应手了,
我要慢慢培养对于计算机的兴趣
unixlinuxsys 2009-06-01
  • 打赏
  • 举报
回复
不知所云
pathuang68 2009-06-01
  • 打赏
  • 举报
回复
顶,扫盲运动
小魔菇 2009-06-01
  • 打赏
  • 举报
回复
跟操作系统没什么关系噢
我还以为是什么个系统的问题
性能侠客行 2009-06-01
  • 打赏
  • 举报
回复
来点实际的..


//1)
void main()
{

printf("Hello World\n");
}


//2)

static void bubblesort(int *ptr,int len)
{
int i,j,change = 1;//change 作为标志,如果在最后一趟之前已有序,则退出循环
int temp;

for(i=len-1;i>0 && change;i--)
{
change=0;
for(j=0;j<i;j++)
if(ptr[j]<ptr[j+1])
{
change=1;
temp=ptr[j];
ptr[j]=ptr[j+1];
ptr[j+1]=temp;
}
}
}

void main()
{
int i;
int arr[10];
printf("Please,input 10 interger numbers.\n");
for(i=0;i<10;i++)
{
printf("%d:",i);
scanf("%d",&arr[i]);
printf("\n");
}
bubblesort(arr,10);
for(i=0;i<10;i++)
{
printf("%d\n",arr[i]);
}


}
//3)
void main()
{
int fd1,fd2,actual;
char *buf = malloc(8*1024);

fd1 = open("\tmp\test.txt", O_RDONLY, 0);

fd2 = open("\tmp\copy.txt", O_WRONLY, 0);
do
{
actual = read(fd1, buf, 8*1024);
if(actual>0)
{
actual = write(fd2, buf, actual);
}
}while(actual>0);
close(fd1);
close(fd2);
free(buf);

}


amossavez 2009-06-01
  • 打赏
  • 举报
回复
楼主你想学习在linux编程?
好好看书吧,太基础了
ltc_mouse 2009-06-01
  • 打赏
  • 举报
回复
[Quote=引用 24 楼 A1989050111 的回复:]
为什么好多人建议网上查呢?网上有很多吗?哪里看得到呢?
[/Quote]
google, baidu,都行~
比如,你想知道vim怎么用,搜索下,会有好多介绍文档的~~
A1989050111 2009-06-01
  • 打赏
  • 举报
回复
为什么好多人建议网上查呢?网上有很多吗?哪里看得到呢?
GaA_Ra 2009-05-31
  • 打赏
  • 举报
回复
就是调用linux中的几个系统call,跟win下用win32的api差不多吧~
lingyin55 2009-05-31
  • 打赏
  • 举报
回复
不过从题目看,是要求在linux下完成的。
所以你找本入门的linux书看看vi和gcc是怎么使用的就行。
至于程序就很简单了。输出一个hello world,一个整数的排序运算,还有一个文件操作。
lingyin55 2009-05-31
  • 打赏
  • 举报
回复
跟操作系统没多大关系

一:Programming with GCC
Edit the source codes with vi/vim, kate, gedit,
or other editors.
Compile the programs with GCC
(1)Write programs
The “Hello world” program: display “Hello
world” on the screen.
(2)Read 10 integer numbers from the
keyboard, output them in descending order.
Print out all the command line parameters
that it receives.

上面不过就是要求你选个编辑器学习编写程序,然后用编译器gcc运行。

二:Calling system calls
Using system calls, write a program in C/C++
that reads data from one file and copies it to
another file.
System calls that might be needed:
open(), close(), read(), write().
(see the man-pages for reference).

第二个就是写个文件操作的。

两个问题baidu一下一大堆答案,不管是linux还是windows,相差都不大


[Quote=引用 10 楼 A1989050111 的回复:]
引用 8 楼 ltc_mouse 的回复:
引用 7 楼 A1989050111 的回复:
是操作系统问题,刚入门,还是一头雾水的

操作系统问题?好像没啥关系~~
知道怎么用vim或gedit等编辑代码,知道怎么用gcc编译程序,剩下的就写几个简单程序了呀


是操作系统中的问题吧?
[/Quote]
A1989050111 2009-05-31
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 ltc_mouse 的回复:]
引用 7 楼 A1989050111 的回复:
是操作系统问题,刚入门,还是一头雾水的

操作系统问题?好像没啥关系~~
知道怎么用vim或gedit等编辑代码,知道怎么用gcc编译程序,剩下的就写几个简单程序了呀
[/Quote]

是操作系统中的问题吧?
liliangbao 2009-05-31
  • 打赏
  • 举报
回复
这不就是在UNIX系统上实现简单的C程序吗~
会C语言和UNIX操作即可了~
ltc_mouse 2009-05-31
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 A1989050111 的回复:]
是操作系统问题,刚入门,还是一头雾水的
[/Quote]
操作系统问题?好像没啥关系~~
知道怎么用vim或gedit等编辑代码,知道怎么用gcc编译程序,剩下的就写几个简单程序了呀
A1989050111 2009-05-31
  • 打赏
  • 举报
回复
是操作系统问题,刚入门,还是一头雾水的
加载更多回复(6)

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧