0
How can i do filing in cpp with data
This is my data 5 4 5 3 6 6 2 4 2 6 7 I want to store first line in one integer. Second line in an array and third line in another array.
8 odpowiedzi
0
CodeCat_ I don't to do it like this
0
CodeCat_ please tell me to do it like that i mentioned
0
How can i do that
0
I wrote
void fileinput(int& terms, int deg[], int coef[])
{
int k = 0;
ifstream fin;
fin.open("polynomials.txt");
int j = 0; int i = 0;
if (fin)
{
fin >> terms;
for (int i = 0; i < terms; i++)
{
fin >> coef[i];
cout << coef[i] << "!";
}
for (int i = 0; i < terms; i++)
{
fin >> deg[i];
cout << deg[i]<<"!";
}
}
fin.close();
cout << terms << "terms" << endl;