hi all,
I am amateur in c++ coding hope you guys will help me. this is the code I tried in my code block 10.05.....tried code for removing all white space from a line of a txt file. this is my code it runs but i cant get the result i need. can you guys fix it or provide me the full code of the program.
thank you all...
i need to run this in a loop so i need this white space remove thingy as a function so i can call it as many times as i want...... :( and i dont know how to use str.find() and str.replace() function and what header file is needed.....
thanks for all the help guys i made a mistake on the for loop thats why i was having problem in the outputs i fixed it later.... thanks again...
I am basically making a scanner for a simple c compiler in my compiler construction course. I will be posting more problems soon. if you guys dont mind.... :P
int main (void){
string str, line[20];
string processingLine[20];
int counter=1;
ifstream myfile ("crap.txt");
for (int i = 0; i<=20 ; ++i){
getline (myfile, processingLine[i]);
line[i] = removespace(processingLine[i]);
}
for (int i = 0; i<=20 ; ++i)
{
cout << "Line #" << i << ":" << line[i] << endl;
}