I just learned c++ and is very hard for me to put in practice what I learned.
So, I would like to know if anybody could help me by giving me tasks and helping me to solve them.
Thanks
eduard77 -3 Junior Poster
Recommended Answers
Jump to PostSo apparently your implementation doesn't do anything to an output file unless you try to write something.
Jump to PostPlease show the full contents of your input file, as well as exactly what the program prints when you run it. Do not try to interpret or explain what the program does. Just the facts, please.
Jump to PostIf your program reads only the first word, it is impossible to get the shortest and longest word, because you have no way of knowing what those words are.
Jump to PostBut this line
"infile >> mystring;"
was supposed to read the whole stringNo -- when you use >> to read into a string, it reads one word.
Jump to PostSo, what should I use instead?
You should arrange for your program to use >> as many times as necessary to read each word, so that you can see which is the longest and which is the shortest.
All 40 Replies
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
eduard77 -3 Junior Poster
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
eduard77 -3 Junior Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
arkoenig 340 Practically a Master Poster
eduard77 -3 Junior Poster
eduard77 -3 Junior Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.