3 years ago, one brother solved this problem, i need this program to make some calculation. actually, i have some fractional/decimal component t (like 2.0213, 3.047) this program can only take integer. Can anybody please help me !!!

#include<iostream>
#include<fstream>
#include<string>
#include<cstdlib>
#include<cmath>
#include<iomanip>
#include <windows.h>

using namespace std;
//void calculateAverage();
//int calculateGrade();
//void updateFrequency();
int main()
       {

        const int size=25;
        int debug=size;
        int test1[size], test2[size];
        ifstream infile;


            for(int i=0;i<size;i++)
                {
                    test1[i]=0;
                    test2[i]=0;
                }


                cout<<"Reading from file ''input.txt''..."<<endl;
                infile.open("input.txt");
                while(size==debug)
                {
            for(int i=0;i<size;i++)
                {
                    infile>>test1[i];
                    infile>>test2[i];
                }
                debug--;
                }
             for(int i=0;i<size;i++)
                {
                cout<<test1[i]<<" "<<test2[i]<<" "<<endl;
                }
        infile.close();


        system("pause");
        return 0;
        }

So, what precisely is your problem?

Thank you. Actually, i have 2 column having 25 value of each. I thought, I can input fraction value( like 2.345, 34.5) but the problem, i faced is that, i can't. only integer like (2, 3) can be input from txt file. So, Can you please make some currection so that i can input decimal value !!!

Change your arrays to double, double test1[size], test2[size];

Thank you Sir !!!
I did it and it's just fine.

You're very welcome. Please remember to mark this solved. thanks

I didn't know that. Now I marked it solved. Thank you !!!

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.