编程学习网为您整理以下代码实例,主要实现:从用户读取年份并转换为整数,希望可以帮到各位朋友。
#include <stdio.h>
#include <stdlib.h>
int main()
{
int methus;
int you;
char years[8];
printf("How old are you?");
gets_s(years);
you=atoi(years);
printf("How old was Jame?");
gets_s(years);
methus=atoi(years);
printf("You are %d years old.\n",you);
printf("James was %d years old.\n",methus);
return(0);
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!