Write a program to read an unknown number of integer numbers stored in a file
nums.txt and calculate the number of negative, the number of
positive numbers and the
number of zeros. Your application should display on the screen the number of negative
and positive numbers as well as the number of zeros.
andreas.petrou.967
0
Light Poster
Recommended Answers
Jump to PostWhat have you tried so far? And please don't say "I don't know how to start", because that's an extremely lame excuse. Anyone with a passing familiarity with C++ should be able to write this as a starting point:
#include <fstream> #include <iostream> int main() { ifstream …
Jump to Postofstream myfile; // input file
In what way does ofstream represent an input file? Take a look at my basic starting point example and work from there. You're reading a file, not writing one.
All 6 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
andreas.petrou.967
0
Light Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
andreas.petrou.967
0
Light Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
andreas.petrou.967
0
Light 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.