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.

22nd Nov 2019, 10:40 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar
8 ответов
0
Do it like this :- 5 4 5 3 6 6 2 4 2 6 7
22nd Nov 2019, 10:46 AM
VOID
VOID - avatar
0
CodeCat_ I don't to do it like this
22nd Nov 2019, 10:49 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar
0
CodeCat_ please tell me to do it like that i mentioned
22nd Nov 2019, 10:50 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar
0
Then use string variable to store the 4 5 3 6 6 in it and then split them and convert those to integer. Do the same for 2 4 2 6 7 too
22nd Nov 2019, 10:53 AM
VOID
VOID - avatar
0
How can i do that
22nd Nov 2019, 10:53 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar
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;
22nd Nov 2019, 10:54 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar
22nd Nov 2019, 10:54 AM
M Abdur Rafey Ahmed
M Abdur Rafey Ahmed - avatar