One Question of the Day 67

Question 67: Input several lines of text from the keyboard, each line ends with a carriage return, and ctrl+z is used as the input terminator, and the number of lines is counted. Insert picture description here

#include “stdio.h”
#include “stdlib.h”
#include “conio.h”
int main()
{
int c,num=0;
while(1)
{
c=getche();
if (c13)
{
printf("\n");
num++;
}
if(c
26)
{ printf("\nYou entered %d line\n",++num); exit(1); } } }




Guess you like

Origin blog.csdn.net/drake_gagaga/article/details/114004358