So in this program im supposed to be reading characters from a file. So i opened the file and read them into an array,
this is the assignment
Write a C++ program that reads in a text file ( called data8.txt), and prints the file to the screen the text with all extra blanks removed (that is, if there are 2 or more blanks in a row, replace them by a single blank) and changes ALL letters to UPPERCASE letters.
WATCH THAT YOU DON'T DELETE CARRIAGE RETURNS and tabs. Whitespace includes tabs and carriage returns as well as blanks…so you only want to get rid of extra blank characters.
I tried using another while loop to identify the blank spaces, something along the lines of
while(array[count]==" ")&&(array[count+1]==" "
but you cannot test to see if it is equal to a character.
any ideas? i would appreciate any help
i had tried something like that initially and it was giving me an error that i couldnt set the character variable to a blank, maybe i made some other error, but i will try it out and let you know if it works,
blastspace is used to know if we have continued spaces. It is set to true if any space is found and so for any next consecutive spaces, nothing will happen, loop will just continue.
as soon the spaces ends, blastspace will be set to false and normal scenario will happen. try debugging to know whats going on.