Created
April 10, 2017 16:29
-
-
Save SeanPlusPlus/f9f98f2517949c89c49a17f03746e04c to your computer and use it in GitHub Desktop.
first program I ever wrote professionally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<fstream> | |
using namespace std; | |
int main() | |
{ | |
ifstream input_file_counter("input_file.txt"); | |
int temp; | |
int NUMBER_OF_DOCUMENTS = 0; | |
while ( input_file_counter >> temp ) | |
{ | |
NUMBER_OF_DOCUMENTS++; | |
} | |
ifstream input_file("input_file.txt"); | |
ofstream output_file; | |
output_file.open("output_file.txt"); | |
int * document; | |
document = new int [NUMBER_OF_DOCUMENTS]; | |
int i, x; | |
for(i = 0; i < NUMBER_OF_DOCUMENTS; i++) | |
{ | |
input_file >> document[i]; | |
output_file << ",Y,,," << document[i] << endl; | |
for(x = 1; x < document[i]; x++) | |
output_file << ",,,," << endl; | |
} | |
output_file.close(); | |
input_file.close(); | |
delete [] document; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment