Was wondering if anyone could help me out with this portion of code
I'm checking through each character, using comments as my logic
Basically Im trying to remove all the whitespace from a text file while keeping the line format
Is my logic correct? And my usage of .get()? How do I delete the space?
Henry Long
fuck wrong one, its this one
Juan Powell
>using automatic get function Go manual or go home kid, this is no place for low tier homework
Brandon Miller
im a math major that has nearly 0 coding experience im sorry :((((
Elijah Bell
your problem is you are not using a good programming language like rust, haskell or common lisp
Liam Nguyen
its required to use c++
Jaxson Rogers
Looks ok to me, but I think it would be better if you used while(chn == ' '), so it would eliminate all consecutive whitespace, not just pairs
Dominic King
char ch; while (!infile.eof()) { infile.get(ch); if (ch != ' ') { cout
Jace Wood
how would i delete the space?
Dylan Cooper
1) design a state machine 2) implement it
Henry Gonzalez
this just prints everything that isnt a space, i need it to print the whole text file removing the spaces and keeping a space between each words and for each line to stay on its line
Liam Taylor
>this just prints everything that isnt a space Yes >i need it to print the whole text file removing the spaces Right, that's what it does >and keeping a space between each words That is contradictory to "removing the spaces"
Clarify what you want. Which spaces do you want to remove specifically?
Nathaniel Reyes
well we don't have any idea what you are allowed or not allowed to do in your homework, but i'm pretty sure you could find 100 different ways to implement it in stackoverflow or random forums, just google it
Anthony Reed
all "extra" whitespaces, im sorry for confusion
so if its "Hello there guys"
it should output "Hello there guys"
Luke Lee
Use sed, fagggot. Fucking java, for text editing.
Samuel Brooks
i meant to add a bunch of spaces in between "hello" amd "there"
Ryan Phillips
Your else statement comes one closing bracket too late.
Hudson Richardson
sed -i 's/\x20\+/\x20/g' fagsfile
Aiden Reed
Oh, so you want to condense multiple adjacent spaces to a single space
char ch; while (!infile.eof()) { infile.get(ch); if (ch != ' ' || infile.peek() != ' ') { cout
Jack Mitchell
holy shit okay!! Now i just need the tabs to be squished so that its line after line
so there's no blank tabbed lines in between the lines
thank you so much for this help you really are helping me out a ton
Ryder Adams
>Now i just need the tabs to be squished so that its line after line Yet again, that doesn't make sense and you need to figure out how to use the English language to articulate what you actually want if you want anyone to help you.
Nathaniel Carter
Figure out how to implement regex in your language of choice.
s/\w+/ /g
Next!
Levi Wright
it should read this, rather than if I were to press TAB a bunch of times after each line
Isaac Reyes
You are terrible at conveying ideas
Joseph Myers
>300k starting any job i want
William Taylor
it should NOT have this output, but rather the one I am replying to
Logan Bailey
it shoudn't be this, but the one i screenshotted before
Colton Parker
So you want to remove lines that only contain whitespace?
Cameron Taylor
Use C #include
int main() { int c, flag; flag = 0; while ((c = getchar()) != EOF) { if (c == ' ') { if (flag == 0) { putchar(c); } flag = 1; } else { putchar(c); flag = 0; } } }
Charles Green
it should be the final.png, but im getting the output from final2.png
You can tweak that lambda as you wish, but you shouldn't write stuff again that is already there..
Nolan Hall
no bueno :/
Eli Gomez
this kinda works #include
// finish with whitespace, \n or eof at peek void processWord() { char ch; while (!std::cin.eof() && !std::isspace(std::cin.peek())) { std::cin.get(ch); std::cout
James Jenkins
sed -e 's/ +/ /g' file
Carson Wood
>won't edit in-place >doesn't escape + >redundant use of e option
Evan Allen
>retarded OP posts this thread over and over >retarded Sup Forums users do his homework for him over and over >nobody learns their lesson people like you ruined my favourite board.