• C

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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ResonanceCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.