鱼C论坛

 找回密码
 立即注册
查看: 3382|回复: 7

C语言作业紧急求助

[复制链接]
发表于 2013-4-9 18:49:33 | 显示全部楼层 |阅读模式
20鱼币
求两个程序的源代码(在linux下)(1)
Write a program that converts all the text you type on standard input into uppercase and eliminates all the digits from the input. The output must be printed onto standard output.
( 2 )   
Write a program nonempty that reads from standard input and writes only non-empty lines to standard output. A line is empty if the newline character is the only character on it
课选错了,C语言基础不好,仅仅是看过一点小甲鱼的一部分视频刚刚学到数组,没想到老师一上来就留这样的作业,求助论坛的高人了,谢谢大家
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-4-9 18:49:34 | 显示全部楼层
  1. #include <ctype.h>
  2. #include <stdio.h>

  3. int main () {
  4.         int c;
  5.         while( (c=getchar()) !=EOF ) {
  6.                 if( isalpha(c) ) putchar( toupper(c) );
  7.                 else if( isdigit(c) ) continue;
  8.                 else putchar(c);
  9.         }
  10. }
复制代码
1.
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-9 20:48:37 | 显示全部楼层
路过帮顶。。。话说虽然学过c,但是英语不好的连题目都不曾看懂。。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-10 11:10:44 | 显示全部楼层
我只是路过打酱油的。
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-10 13:51:54 | 显示全部楼层
main()
{
     char in_put[1024]={0};
     int i=0;
     while(1)
    {
         scanf("%s",in_put);
         for(i=0,i<strlen(in_put),i++)
         {
               if(in_put[i]==' ')
               {
                   continue;
               }
              printf("%c",in_put[i]);
         }
        
    }

}

第二个问题类似了
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-10 13:54:04 | 显示全部楼层
第二个问题有点看不大懂,能不能中午翻译下先
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-10 16:38:15 | 显示全部楼层
貌似用的编译器就不一样啊
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2013-4-10 21:09:50 | 显示全部楼层
  1. #include <ctype.h>
  2. #include <stdio.h>
  3. #include <string.h>

  4. #define MAX_LINE 200
  5. int main () {
  6.         char data[MAX_LINE];
  7.         while( gets(data) )
  8.                 if( strlen(data) >0 )
  9.                         puts(data);
  10. }
复制代码
2.
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-8-4 08:21

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表