anonymous
  • anonymous
C++ Program help the assignment is to create a program that reads a data file that should contain only integers values and thus should contain only digits, plus or minus signs, and whitespace. the program should print any invalid characters located in the file, and at the end it should print a count of the invalid characters located. (print means show in screen). my current attempt is this:
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
#include #include #include using namespace std; int main() { ifstream fin; int x; fin.open("invalid.txt"); cout <<"state of fin stream:" << endl<>x; while (!fin.eof()) { cout<>x; } cout <<"state of fin stream:" << endl<
anonymous
  • anonymous
i have no idea how to make the program not just crash and burn when it sees a letter in the file, and no idea how to make it display the invalid characters. Pleas help!
anonymous
  • anonymous
I would try to run through the file once, collecting all the invalid characters (into a vector or array of characters), and then print them all out at the end. This would involve: making a storage vector, running through the file finding invalid entries, closing the file, printing out the elements of the array, and then printing out the size of the vector.

Looking for something else?

Not the answer you are looking for? Search for more explanations.