我们有多少人在此代码中进行了更改? [英] how many we make change in this code?

查看:64
本文介绍了我们有多少人在此代码中进行了更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// error check
#include<stdio.h>
#include<conio.h>

void main()
{
    int i,n;
    n=20;
    clrscr();
    for(n=0;i<n;i--){>
    printf("*");}
    getch();
}



无需在此代码中添加任何内容.
我该怎么办?
输出是************************** 20星.



nothing to adding in this code.
what can i do?
output is *************************20 star.

推荐答案

在您的代码中,则变量"i"没有初始化.
也许您可以更改"for(i = 0; i< n; i ++)".>
In your code,the variables "i" isn''t initialize.
maybe you can change "for(i=0;i<n;i++)".>


您的问题不清楚,您的英语也不清楚(抱歉表示... )
Your question is not clear and so is your English (sorry for indicating that...)


如果输出应为20星(*),则可以通过以下方式进行操作:
If the output should be 20 stars (*), you can do it in the this way:
#include <stdio.h>
#include <string.h>
#include <conio.h>

int main ()
{
  char str[21]; //21 because 20 stars and '\0' at the end 
  strcpy (str,"*********************"); //fill 
  //or char str[21] = {"*********************"};
  //or char str[] = {"*********************"};  //automatically preserve the size
  printf(str);
  getch();
  return 0;
}



C-我差点忘了它;)



C - i almost forgot it ;)


这篇关于我们有多少人在此代码中进行了更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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