-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExperiments.cpp
More file actions
48 lines (44 loc) · 858 Bytes
/
Experiments.cpp
File metadata and controls
48 lines (44 loc) · 858 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
#include<iostream>
#include<stdio.h>
using namespace std;
main()
{
int t,n,total=0,c=0,r=0,s=0;
float ans;
char C;
cin >> t;
for(int i=0;i<t;i++)
{
cin >> n >> C;
total+=n;
if(C=='C'){
c+=n;
}
else if(C=='R'){
r+=n;
}
else if(C=='S'){
s+=n;
}
}
cout<<"Total: "<<total<<" cobaias"<<endl;
cout<<"Total de coelhos: "<<c<<endl;
cout<<"Total de ratos: "<<r<<endl;
cout<<"Total de sapos: "<<s<<endl;
ans = (c*100);
ans = ans/total;
cout << "Percentual de coelhos: ";
printf("%0.2f",ans);
cout << " %"<<endl;
ans = (r*100);
ans = ans/total;
cout << "Percentual de ratos: ";
printf("%0.2f",ans);
cout << " %"<<endl;
ans = (s*100);
ans = ans/total;
cout << "Percentual de sapos: ";
printf("%0.2f",ans);
cout << " %"<<endl;
return 0;
}