pointers, strcmp( ) and getline( )

I really need help writing the following program that takes text as input and copies it to its output, minus any lines that are  the same as the line they follow Example:  

if the input consists of the lines:  
C  
is  
great  
great  
program  
program  

the output should be:  
C  
is  
great  
program    

Should also use high level functions, main(),  getline(),strcmp(). Also must use pointer in  main and all the functions mentioned above. The  program must accept 50 lines and then perform the  edit.   I really appreciate all the help I can get. Thank
you
 
 
kkanealAsked:
Who is Participating?
 
ResonanceConnect With a Mentor Commented:
You know, it's considered bad form to ask someone to do your homework for you.

In any case, the simplest way of doing it is to create a two dimensional character array, say inpstr[50][70], for 50 lines of 70 characters, and then use a for loop to read each of the 50 lines into the correct array.  From there, output the first string immediately and then strcmp inputstr[ctr] and inputstr[ctr-1] for all the remaining strings.  If they are not the same, output inputstr[ctr].  If they are the same, skip the output step and go to the next string.

I'd provide code, but you really ought to do some of this yourself...
0
 
kkanealAuthor Commented:
This is not a homework questions. I'm learning C programming on my own and ran into this question. Thats why I need help.

Thanks
0
All Courses

From novice to tech pro — start learning today.