键盘输入字符串

#include stdio.hint main(void){char initial[3] = { };char name[80] = { };

编程学习网为您整理以下代码实例,主要实现:键盘输入字符串,希望可以帮到各位朋友。

#include <stdio.h>

int main(voID)
{
  char initial[3] = {' '};
  char name[80] = {' '};

  printf("Enter your first initial:  ");
  gets_s(initial, sizeof(initial));
  printf("Enter your name:  " );
  gets_s(name, sizeof(name));
  if(initial[0] != name[0])
    printf("%s, you got your initial wrong.\n", name);
  else
    printf("Hi, %s. Your initial is correct. Well done!\n", name);
  return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐