一个c语言输入一个字符的问题

关于c语言的问题 首先输出一个1,如果你输入一个2的话上面只会显示一个2,输入一个abcd上面只会_百度知道
关于c语言的问题 首先输出一个1,如果你输入一个2的话上面只会显示一个2,输入一个abcd上面只会
如果你输入一个2的话上面只会显示一个2,输入一个abcd上面只会显示abcd。
请问要符合上面的要求应该如果编写程序关于c语言的问题首先输出一个1
提问者采纳
char xxx[字符长度]
scanf%s和printf打出来哦
没有,重要的是如何清空
只剩下你输入的东西
VC6.0 里用可以用system(&cls&);包含头文件#include &stdlib.h&TC 用#include&conio.h&clrscr();
提问者评价
太给力了,你的回答完美地解决了我的问题,非常感谢!
其他类似问题
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁c语言 问题:输入一个 1 ~ 26 数字,输入n,则打印出n行。按照如下图显示_百度知道
c语言 问题:输入一个 1 ~ 26 数字,输入n,则打印出n行。按照如下图显示
输入n,则打印出n行。按照如下图显示 A BBB CCCCC DDDDDDD ……… ZZZZZZZZZ ZZZZZZZZ ( 51个) 新手 求解 !!!谢谢 各位高手!1. 输入一个 1 ~ 26 数字
提问者采纳
#include &lt.h& void main() { *每行的字母数*/
+ i);A'
/*输入的提示信息*/scanf(& printf(&Please input number, 'printf(&quot:\n&);%d&, &n); for (i = 0;*行数*/%c& i & printf(& i++) /{ for (j = 0; j & (2 * i + 1); j++)
/*每行的字母*/\n&)你好
其他类似问题
按默认排序
其他3条回答
=26;*每行结束后#include &i&lt,c);*一行之内输出的是相同字符*/n&quot.h&\ for(i=1;
printf(& main() { char c='A';i++)
/*总共26行*/j++) /);{ for(j=1;j&
printf(&2*i;*每行的个数比行号的2倍小1*/%c&;
/ /*此句不在第二重循环内,它用于控制每输出一行要换行*/
&#47,输出的字符要发生相应的变化*&#47,j
for(i = 0; i & 26; i++) { for(j = 0; j & 2 * i + 1; j++) printf(&%c&, 'A' + i); printf(&\n&); } 给你的建议: 1. 多看程序,注意书写格式!!! 2. 下次记得给点分。呵呵!
scanf(&%d&,&a);for(int i=1;i&a*2-1;i++)
putchar('A'+a-1);putchar('\n');
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁一个简单的C语言输出问题_百度知道
一个简单的C语言输出问题
scanf(&even),直到输入0;}&#47.3f&;我的控制台如下,even_sum=0;int main(void){ int input,
odd_sum+=);0) {
printf(&quot,even,odd_sum=0.输入终止后。该程序读取整数;) {
if(input%2==0)
even++:#include &lt?是代码问题还是平台问题; printf(& for (input=0;.0;%d&quot.0;);
} } printf(&The odd number is %d&quot:*******************************************************************************84534640Rhe even number is 1编写一个程序.3f& if (even_sum&gt,and the average is 0;odd);
even_sum+=input,odd_; } putchar('0) {
printf(&&#47,odd_sum&#47.000Rhe odd number is 1; double even_n'),&input)==1&&input?谢谢; if (even_sum&gt,and the average is %; } putchar('&#92,
return 0;!=0,odd.h&gt,even_sum&#47。我的代码如下.000*******************************************************************************求解为什么会这样、偶数的平均值;&#92,and the average is %;n');
odd++,输入的奇数总个数以及奇数的平均值;The even number is %d&,and the average is 0,程序应该报告输入的偶数(不包括0)总个数
提问者采纳
,,。起码的你的for循环的输入会蛋蛋疼数组,,虽然说提交回答能用for的解决。,但是为啥不用while==》解决,链表
可是这个问题需要用数组吗?还有for和while在这里能有什么区别?
不用,,,之后的追加是追错了,,,,while会看着舒服点,,,,能用for的也可以用while反正是通用的,,,,while(scanf(&%d&,&n)==1)在成功读入1个数据时执行循环体我把你代码拿下来改改吧。。。。之前没看#include&&stdio.h&#include&stdlib.h&&int&main(void){static int&input,even=0,odd=0;static double&even_sum,odd_ for&(input=0,even_sum=0.0,odd_sum=0.0;scanf(&%d&,&input)==1;) {
if(input%2==0)
even_sum+=
// even_sum=even_sum/
printf(&The&even&number&is&%d\n&,even);
printf(&The&odd&number&is&%d\n&,odd);
if(input==0){
printf(&The&even&number&is&%d\n&,even);
printf(&,and&the&average&is&%f\n&,even_sum/even);
printf(&The&odd&number&is&%d\n&,odd);
printf(&,and&the&average&is&%f\n&,odd_sum/odd);
system(&pause&);
} return&0;}
提问者评价
其他类似问题
/return 0;打完一行换行}
/k&&#47,k,j;
//*&quot#include& &j++)
/控制每个星号前面有几个空格
printf(&/=4-2*i;/i++){
printf(&););=2*i;控制打几个星号
printf(&j++)
printf(&for(i=0;i&=2-i;
/控制每个星号前面有几个空格
printf(&/=2;/i++)
/i&k&=i;前四行星号图形{
for(j=0;\j&/
for(k=0;*&=3;n&);j&打完一行换行}getch().h&/int main(){ &\控制打几个星号
printf(&n&);k++) /下面三行倒三角星号图形for(i=0;
c语言的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁这是一个C语言的二叉树问题。求高手帮忙看下我的程序哪有问题? 程序一执行就会显示一堆乱码,不让输入。_百度知道
这是一个C语言的二叉树问题。求高手帮忙看下我的程序哪有问题? 程序一执行就会显示一堆乱码,不让输入。
}}struct tnode *talloc(){ return( (struct tnode *)malloc( sizeof(struct tnode) ) );;}char *getword(){ char *p, F%4d%s\word) )==0 ) p-&O struct tnode * if( strlen(p)==0 )
return(NULL),p-&n&char *getword();n&quot.h&gt,t);word);{ if(%MAXWORDs&
p-&),w ):C++;}treeprint(p)struct tnode *p; return(p).h&gt,w )struct tnode *p;left=p-&gt,p-&char *w;right=tree( p-&right); struct tnode *
} else if( ( cond=strcmp(w,w );
},*tree();#include &count=1。#include &left=tree( p-&0 ) p-&gt,p).h& if( ( p=malloc(MAXWORD+1) ) ==NULL )
printf(&quot,char *);
treeprint(p-& else
p-&gt,p-&gt!=NULL )
treeprint( p-&gt, J
printf(&right=NULL;word=w; if(p==NULL)
p=talloc();}struct tnode *tree(#define MAXWORD 20struct tnode
{ char *int main(){ struct tnode *root.h& getch(); return(p);{ struct tnode *talloc();treeprint(struct tnode *);
return(NULL)! \ char *t; return 0;
p-&count++; root=NULL;struct tnode *tree(struct tnode *;
} scanf(&quot。程序执行后由程序输出结果, F while( ( t=getword() ) :若输入如下单词题目是这样的;#include & else if( cond&lt, Bleft );#include &lt!=NULL )
root=tree( treeprint( root )
提问者采纳
n&销毁voiddestroy (node *root){
destroy (root-&
node_count (head-&
int a[] = ;right);malloc&
free (root);left,可以用它来建数和验证这个计算结点个数的函数^_^#include &left = NULL;count = %d\left);
exit (1);data)
current = current-&;right = NULL;data)
node_count (root-&
current = *
printf (& sizeof a[0];建树;中序遍历该树;
struct node *typedef struct node{
destroy (root):void node_count (node *head){
if (head ,求结点个数还是比较简单的; current-&#include &
Inorder (root-&right);
bak-&gt!= NULL)
count++,也是你最想看到的吧;
}}&#47,函数如下;
}}&#47,目的是验证一下程序是否正确voidInorder (node * root){
Inorder (root-& bak-&gt, *这部分是最关键的了!= NULL)
bak = / int count = 0, root-&
node_count (head-&\
node_count (root); i &
if (p == NULL)
perror (&quot.h&/
if (x &/)!= NULL)
count++, a[i]);
node_count (root-&
}} intmain (){
node *root = NULL;right =
current = current-&gt,为了方便;
}}再附上一个完整的程序吧;
for (i = 0;
struct node *left, count);left),最方便的就是使用递归算法了;data);
n = sizeof a /data = i++)
create_tree (&left);}
if (x &left =left);
destroy (root-&right);%d &
root = NULL;;stdlib,我建的是二叉排序树voidcreate_tree (node ** root,就是节点统计计数的函数voidnode_count (node *root){
if (right););n&quot.h&gt对于第一个问题;
return 0;//
if (*root == NULL)
node *p = (node *) malloc (sizeof (node)), int x){
Inorder (root)
其他类似问题
二叉树的相关知识
其他1条回答
顺便说一下;%s&改成scanf(&quot,采用的是早已被C语言抛弃的代码编写风格,p);%MAXWORDs&quot把scanf(&quot,你这个程序也太古老了吧;,p);
为什么不能这样写呢?scanf(&%MAXWORDs&,p);
这样写是不是违反了scanf的语法规则?
是的。scanf里%后面的内容有规定的格式,不能随便写。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁输入一个整数,然后输出小于等于该数的所有素数,C语言问题。_百度知道
输入一个整数,然后输出小于等于该数的所有素数,C语言问题。
printf(&quot。是什么问题; t*t&lt,调试的时候发现第二个for循环总是不循环啊;请输入;=x;
scanf(&循环判断是否是素数
if(i%t==0)
{ / printf(&quot.h&n&quot,i);
for(int i=2; i++) /; t++)/%d&#92,&x);int main(){
i&&#47:&;%d&quot? 我这么写之后总是不对;=i;比X小并且大于2的数
for(int t=2;
#include &lt?#include &lt,结果导致很多不是素数的也跑进来了.h&);
return 0不能用两个for循环解决么
hiphotos.baidu:///zhidao/wh%3D600%2C800/sign=dc8a786be7f/adaf2edda3cc7cd97f3fb80e913c.hiphotos.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="http.baidu.jpg" esrc="/zhidao/pic/item/adaf2edda3cc7cd97f3fb80e913c://c://c<a href="/zhidao/wh%3D450%2C600/sign=8da6e056c93d70cf4cafa209cdecfd36/adaf2edda3cc7cd97f3fb80e913c
提问者采纳
循环判断是否是素数
if(i%t==0)
flag=1;=x,&x):&比X小并且大于2的数 {
flag=0.h&%d&#92;/=i&#47:100357111317192329313741434753596167717379838997Press any key to continue#include &); t++)/
if(flag==0)
printf(&int main(){ n&stdio请输入;请输入,t, t&; i++) /,x; printf(&
for( t=2; scanf(&2;%d&
return 0; for( i=3; i&&#47,i);#include &math.h&gt
其他类似问题
for(m=2,k;=m;m&#include &i++)
if(m%i==0)main(){ %d&scanf(&quot.h&
if(i==m) printf(&m++) {for(i=2;,&k);i&%d &quot,m),m
素数的相关知识
按默认排序
其他2条回答
我不懂这个。。。。
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}

我要回帖

更多关于 c语言输入一个字符 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信