Different variables, same result

is there something wrong with the code, because no matter what variables I put it to the text document it reads from, I still get the statement "true", even if it defies the rule above itself.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
void Skaityti (int & k, int & s, int & b, int & i, int & n);
void Spausdinti (int k, int s, int b, int i, int n);
const char Cmax = 100;
int main()
{
setlocale(LC_ALL, "Lithuanian");
int k; //gaunami kisenpinigiai
int s; //buteliuko sulciu kaina
int b; //buteliu supirkimo kaina
int i; //savaites diena
int n; //turimi pinigai
Skaityti (k, s, b, i, n);
Spausdinti (k, s, b, i, n);
return 0;
}
void Skaityti (int & k, int & s, int & b, int & i, int & n)
{
    ifstream fd ("sultys.txt");
    fd >> k >> s >> b >> i >> n;
}
void Spausdinti (int k, int s, int b, int i, int n)
{
    ofstream fr ("sultysrez.txt");
/*cout << k << endl;
cout << s << endl;
cout << b << endl;
cout << n << endl;
cout << i << endl;*/
int kiekis; //isgertu sulciu kiekis
if (1 <= i <= 7)
{
    cout << "true";
}
else
{
    cout << "false";
}
cout << i;
for (int j=1; j < s; j++)
{


}
}
if (1 <= i <= 7)
Sadly, you can't do that!

Did you mean
if (1 <= i && i <= 7)
Now it works, thank you so much. I might have misunderstood, because it's a text based task and I just copied the rule.
Topic archived. No new replies allowed.