Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- char fileName[15];
- int num,
- posCount = 0,
- negCount = 0,
- i = 0,
- p = 0;
- int posArr[posCount],
- negArr[negCount];
- cout << "Enter the name of the file you wish to open: " << endl << "(MUST BE 15 CHARACTERS OR LESS)" << endl;
- cin >> fileName;
- ifstream inputFile;
- inputFile.open(fileName);
- inputFile >> num;
- while(num != 999)
- {
- if(num > 0)
- {
- num = posArr[posCount];
- posCount++;
- }
- else if(num < 0)
- {
- num = negArr[negCount];
- negCount++;
- }
- else
- cout << "Do not enter 0 as a value." << endl;
- if (num == 999)
- {
- cout << "Positive Numbers:" << endl;
- for(i = 0;i < (posCount + 1);i++)
- {
- cout << posArr[i] << endl;
- }
- cout << "Negative Numbers:" << endl;
- for(p = 0;i < (negCount + 1);p++)
- {
- cout << negArr[p] << endl;
- }
- inputFile.close();
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement