没有合适的资源?快使用搜索试试~ 我知道了~
C小程序案例
需积分: 9 5 下载量 49 浏览量
2011-10-26
09:08:25
上传
评论
收藏 13KB TXT 举报
温馨提示
试读
27页
包含很多基础理论的测试代码。包括str,array,for循环等。希望对大家有帮助!
资源推荐
资源详情
资源评论
[root@localhost ctest]# more scan.c
#include <stdio.h>
main()
{
int chan;
int dacvalue;
if (scanf("%d,%d",&chan,&dacvalue)!=2)
printf ("no 2 \n");
else
printf ("2 \n");
printf ("%d,%d \n",chan,dacvalue);
}
===========================
[root@localhost ctest]# more ifif.c
#include <stdio.h>
main()
{
int a=5;
int b;
b=a<6?3:2;
printf ("%d \n",b);
}
[root@localhost ctest]# ./ifif
#include <stdio.h>
main()
{
int chan;
int dacvalue;
if (scanf("%d,%d",&chan,&dacvalue)!=2)
printf ("no 2 \n");
else
printf ("2 \n");
printf ("%d,%d \n",chan,dacvalue);
}
===========================
[root@localhost ctest]# more ifif.c
#include <stdio.h>
main()
{
int a=5;
int b;
b=a<6?3:2;
printf ("%d \n",b);
}
[root@localhost ctest]# ./ifif
3
===========================
[root@localhost ctest]# more if.c
#include <stdio.h>
main()
{
int a;
if (a)
printf ("yes %d \n",a);
else
printf ("no %d \n",a);
}
[root@localhost ctest]# ./if
yes 1557952
如果加int a=0;
[root@localhost ctest]# ./if
no 0
============================
[root@localhost ctest]# more get.c
#include <stdio.h>
int main(int argc, char *argv[])
{
char a = 0, b = 0;
a = getchar();
b = getchar();
===========================
[root@localhost ctest]# more if.c
#include <stdio.h>
main()
{
int a;
if (a)
printf ("yes %d \n",a);
else
printf ("no %d \n",a);
}
[root@localhost ctest]# ./if
yes 1557952
如果加int a=0;
[root@localhost ctest]# ./if
no 0
============================
[root@localhost ctest]# more get.c
#include <stdio.h>
int main(int argc, char *argv[])
{
char a = 0, b = 0;
a = getchar();
b = getchar();
剩余26页未读,继续阅读
资源评论
fangmo732
- 粉丝: 1
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功