I code my programe for showing student profile
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    int array_size = 500;
    char * array = new char[array_size];
    int position = 0;
    ifstream fin("data.txt");
    if(fin.is_open())
    {
        while(!fin.eof() && position < array_size)
        {
            fin.get(array[position]);
            position++;
        }
        array[position-1] = '\0';
        for(int i = 0; array[i] != '\0'; i++)
        {
            cout << array[i];
        }
    }
    else
    {
        cout << "File could not be opened." << endl;
    }
    return 0;
}
and here is data.txt
Name : Napat Naraprapang
ID : 45608
Subject                             Credit      Grade
Thai                                 1.0          4 
Mathematics                          1.0          4
Social Studies                       1.0          4
Health and Physical Education        0.5          4
Thai Dance                           0.5          3
Vocational Education and Tecnology   0.5          4
English                              1.0          4
Advance Mathematics                  2.0          4
Physics                              1.5          3.5       
Chemistry                            1.5          3
Biology                              1.5          4
Handball                             0.5          4
Computer Project                     1.0          4
English Reading Analysis             1.0          4
English for Information              0.5          4
I want to calculate gpa and show it below, should I do? Actually, first time I created function to calculate gpa before
for(int i = 0; array[i] != '\0'; i++)
            {
                cout << array[i];
            }
        }
        else
And when I complied it, everything was lose, I dont know what did I do wrong? and what should I do? Thank you for your all replies!
 
     
    