Im just starting to learn c++ and I've run into a little problem. After declaring variables they have value assigned to them.
#include <iostream>
#include <fstream>
using namespace std;
ifstream d ("d.txt");
ofstream r ("r.txt");
int plotas (int a, int b);
int main()
{
int p,
a,
n,
x1,
x2,
y1,
y2,
s,
s1;
d >> p >> a;
d >> n;
for(int i =0; i < n; i++){
d >> x1 >> y1 >> x2 >> y2;
s+= plotas((x2-x1), (y2-y1));
}
s1= plotas(p, a)- s;
cout << s1;
}
int plotas (int a, int b){
return a*b;
}
For example variable s is 1967866170. Shouldn't they all be 0? What am I doing wrong?