hello all. I am in the proccess of writing a program for my astrophysics club. to sum up the function of the program basically, the program simulates taking pictures of the universe based on its location and other details which is read from a .txt file then outputs various magnitudes (determined by clarity of the photo) based on various filters, in a table. Writing the program, everything seems to work the way it needs to, except in the .txt file, nothing is seeming to be read past the 1900th number.

At first I thought it was because the range of my rows were too small, so I changed it from a const int to a const long long; however the program still reads to the 1900th number. I was wondering if there was a way to modify the program so that all the numbers would be read and appropriately sorted.

I'm not sure if this helps, but I am using netbeans v7.1.2 as my ide and cygwin as my complier. Also, for the final version of the program I want to include 3 more .txt files , for a total of 5 .txt files, not just the 2 I am posting here.

Hm... there seems to be an issue uploading directly to the forum so here's a link where you utilize the .txt files. 4shared folder - My 4shared


the code:
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <sstream>
using namespace std;
const long long ROWS=100;
const int COLS=26;
int linearSearch(string[],string, int);
int main(){
    ifstream file1("test.txt");
    ifstream file2("test1.txt");
    
    double fullTable1[ROWS][COLS];
    double extractTable1[ROWS][COLS];
    double fullTable2[ROWS][COLS];
    double extractTable2[ROWS][COLS];
    double combineTable[ROWS][COLS];
    
    string st1[ROWS],st2[ROWS];
    string s1,s2;
    string line;
    
    ostringstream convert;
    
    int count1=0;
    int count2=0;
    int count3=0;
    for (int i=0;i<28;i++)      //Ignore the command line in file 1
    getline(file1, line);
    for (int i=0;i<28;i++)      //Ignore the command lines in file 2
    getline(file2, line);
    for(int row=0;row<ROWS;row++)       //Read into the two files
        for(int col=0;col<COLS;col++){
            file1>>fullTable1[row][col];
            file2>>fullTable2[row][col];
        }
    for(int row=0;row<ROWS;row++)       //Read file 1 into array 1
        if (fullTable1[row][6]<40){
        extractTable1[count1][0]=fullTable1[count1][0];
        extractTable1[count1][1]=fullTable1[row][3];
        extractTable1[count1][2]=fullTable1[row][4];
        extractTable1[count1][3]=fullTable1[row][6];
        count1++;
    }
    for(int row=0;row<ROWS;row++)       //Read file 2 into array 2
        if (fullTable2[row][6]<40){
        extractTable2[count2][0]=fullTable2[count2][0];
        extractTable2[count2][1]=fullTable2[row][3];
        extractTable2[count2][2]=fullTable2[row][4];
        extractTable2[count2][3]=fullTable2[row][6];
        count2++;
    }
    for(int row=0;row<count1;row++){
        convert<<extractTable1[row][1];
        s1=convert.str();
        convert.str("");
        convert<<extractTable1[row][2];
        s2=convert.str();
        convert.str("");
        st1[row]=s1+s2;
    }
     
    for(int row=0;row<count2;row++){
        convert<<extractTable2[row][1];
        s1=convert.str();
        convert.str("");
        convert<<extractTable2[row][2];
        s2=convert.str();
        convert.str("");
        st2[row]=s1+s2;
    }
    
    int pos;
    for(int row=0;row<count1;row++){
        //Assign the address in file 1 to two one-dimensional arrays
        s1=st1[row];
        //Search for the address in file 2
        pos=linearSearch(st2,s1,count2);
        //Read into a combined table if the address matches
        if(pos!=-1){
            combineTable[count3][0]=extractTable1[count3][0];
            combineTable[count3][1]=extractTable1[row][1];
            combineTable[count3][2]=extractTable1[row][2];
            combineTable[count3][3]=extractTable1[row][3];
            combineTable[count3][4]=extractTable2[pos][3];
            count3++;
        }
    }
    for(int row=0;row<count3;row++){
            cout<<setw(6)<<showpoint<<setprecision(0)<<combineTable[row][0]<<"\t";
            cout<<fixed<<setprecision(4);
            cout<<setw(10)<<combineTable[row][1]<<"\t";
            cout<<setw(10)<<combineTable[row][2]<<"\t";
            cout<<setw(10)<<combineTable[row][3]<<"\t";
            cout<<setw(10)<<combineTable[row][4]<<"\t";
            cout<<endl;
    }
    file1.close();
    file2.close();
    return 0;
}
int linearSearch(string st2[], string s, int c){
    int position=-1;
    for (int row=0;row<c;row++)
        if (st2[row]==s)
            position=row;
    return position;
}