18 2008

C语言学习第二天

Posted by Yangybcy in 资料

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  char buffer[256];
 
  printf ("enter you name and press <Enter>:\n ");
  gets( buffer );
 
  printf (buffer);
  printf ( " \n your name has %d characters and spaces! \n \n ", strlen ( buffer ));
 
  system("PAUSE"); 
  return 0;
}
 

运行效果:

第1个 fgf  是自己输入

第2个 fgf 是系统使用printf (buffer )打印出来的

your name has 3 characters…….  中的数字3   使用%d打印出来的

收藏与分享

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:arrow: :) :-| :evil: more »