Can you help me on this one? Why can't the g++ compile this peace of code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Can you help me on this one? Why can't the g++ compile this peace of code?

#include <fstream> using namespace std; /* Se introduc două şiruri de numere cu acelaşi număr de elemente. Să se verifice dacă valorile lor, în ordinea dată, sunt proporţionale. Exemplu: Date de intrare: n=3 sir1: 1 2 3 sir2: 3 6 9 Date de ieşire: Da. */ ifstream i("D:\\ProblemeInformatica\\ex1verprop\\date.in", ios::out); ofstream o("D:\\ProblemeInformatica\\ex1verprop\\date.out", ios::in); float s [1000], j [1000], r1; int n; bool sunt = 1; int main() { i >> n; // numarul de elemente pe care le vom folosi for(int c = 0; i < n; c++) i >> s[c]; // counter for (int c2 = 0; i < n; c2++) i >> j[c2]; // counter2 r1 = s[0] / j[0]; // primul raport for (int c3 = 1; i < n; c3++) if(r1 != ( s[c3] / j[c3] )) { sunt = 0; break; } if(sunt) // sunt proportionale? o << "Da"; else o << "Nu"; return 0; }

25th Jan 2018, 10:02 AM
XOPGAMINGX _300
XOPGAMINGX _300 - avatar
2 Answers
0
Ar fi folositor dacă ai spune și ce erori ai. Încearcă sa scoți argumentele ios::out și ios::in și vezi dacă merge. Or am I mistaking by assuming you speak romanian?
25th Jan 2018, 11:29 AM
Vlad Serbu
Vlad Serbu - avatar
0
Da vorbesc romana.
25th Jan 2018, 12:00 PM
XOPGAMINGX _300
XOPGAMINGX _300 - avatar