forked from Dashark/hello-world
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUntitled2.cpp
More file actions
52 lines (52 loc) · 673 Bytes
/
Untitled2.cpp
File metadata and controls
52 lines (52 loc) · 673 Bytes
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
49
50
51
52
#include <iostream>
class HanXin
{
public:
void line3(int n);
void line5(int n);
void line7(int n);
int showMany();
private:
int n1;
int n2;
int n3;
} ;
void HanXin::line3(int n)
{
n1=n;
}
void HanXin::line5(int n)
{
n2=n;
}
void HanXin::line7(int n)
{
n3=n;
}
int HanXin::showMany()
{
int n;
for(n=10;n<=100;n++)
{
if(n%3==n1&&n%5==n2&&n%7==n3)
{
std::cout<<n<<"\n";
return 0;
}
}
std::cout<<"Impossible"<<"\n";
}
int main()
{
int n,n1,n2,n3;
std::cin>>n;
for(int i=0;i<n;i++)
{
std::cin>>n1>>n2>>n3;
HanXin hx;
hx.line3(n1);
hx.line5(n2);
hx.line7(n3);
hx.showMany();
}
}