cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
counting no. of input lines
counting no. of input lines
Jul 3, 2012 at 6:59am UTC
vgoel38
(133)
#include<stdio.h>
#include<conio.h>
main()
{
int c, nl;
nl = 0;
while ((c = getchar()) != EOF)
if (c == '\n')
++nl;
printf("%d\n", nl);
getch();
}
not getting output!!
Jul 3, 2012 at 7:42am UTC
Catfish2
(666)
Your problem is that you don't know how to signal EOF from keyboard.
Try pressing Ctrl-Z and Enter.
1238yy sdio21 asdiou23 ^Z 3
Jul 5, 2012 at 6:00am UTC
vgoel38
(133)
yeah..you are right.. :P..thnx
Topic archived. No new replies allowed.