Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Write a program in c or c++ that reads an input file and copies its entire contents into an output file after removing all white spaces which includes single space, multiple spaces, tab space and new lines.

What I have tried:

couldnt get started








/
Posted
Updated 30-Mar-17 6:41am
Comments
jeron1 30-Mar-17 12:05pm    
...and the question is?
[no name] 30-Mar-17 12:07pm    
I am feeling generous this hour. To get you started,
int main()
{
// fill in the rest of your code here
return 0;
}

1 solution

You must learn some coding, but I will give you some tips. With the function strchr you get the occurance of a char in a string. With that information you can make a new string with left and right part without the char you want to eliminate. If you can use libraries than you can use replace with an empty char ("").
Look and learn the meaning of ASCII-characters to find the tabs and new lines.

Good luck with your homework.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900