How can i fix this

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double volume;
int cnt = 0 ;

cout<<"Please enter volume: ";
cin>>volume;

cout << fixed <<setprecision(2) ;
for( double concen = 100.0 ; concen > 50.0 ; concen=(volume * concen ) / (volume + 5))
{

cout << ++cnt << ". concentration " << concen << "% volume: " << volume << '\n' ;
}
system("pause");
}


the output is like this

1 Concentration: 90.00% Volume: 50 ml
2 Concentration: 81.00% Volume: 50 ml
3 Concentration: 72.90% Volume: 50 ml
4 Concentration: 65.61% Volume: 50 ml
5 Concentration: 59.05% Volume: 50 ml
6 Concentration: 53.14% Volume: 50 ml
7 Concentration: 47.83% Volume: 50 ml

my problem is how can i make it like this
8 Concentration: 47.83% Volume: 45 ml
9 Concentration: 47.83% Volume: 40 ml
10 Concentration: 47.83% Volume: 35 ml
11 Concentration: 47.83% Volume: 30 ml
12 Concentration: 47.83% Volume: 25 ml
13 Concentration: 47.83% Volume: 20 ml
14 Concentration: 47.83% Volume: 15 ml
15 Concentration: 47.83% Volume: 10 ml
16 Concentration: 47.83% Volume: 5 ml
17 Concentration: 47.83% Volume: 0 ml
Tessa can shampoo 8 times before stopping to water it down.

after concentration hitting 50 volume will be subtracted by 5 then it will displays what number concentration hits 50

thank you


closed account (Dy7SLyTq)
1) use [ code ] [/ code] tags.
2) plz describe your problem more clearly (dont make us look for it)
3) don't use system in real world applications
this is what you should serve, but did not mathematical correspondence. In brief is a imposition valid only for your request.
ciao

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
    int cnt = 0;
    double k; // this is volume value
    
    cout<<"Please enter volume: ";
    cin>>k;
    double z = k/(k+5);
    cout << fixed <<setprecision(2) ;
    for( double concen = 100.0; k>0; concen>50 ? (concen = z * concen):( k-=5))
    {
        cout << ++cnt << ". concentration " << concen << "% volume: " << k << '\n' ;
    }
    return 0;
}


Please enter volume: 50
1. concentration 100.00% volume: 50.00
2. concentration 90.91% volume: 50.00
3. concentration 82.64% volume: 50.00
4. concentration 75.13% volume: 50.00
5. concentration 68.30% volume: 50.00
6. concentration 62.09% volume: 50.00
7. concentration 56.45% volume: 50.00
8. concentration 51.32% volume: 50.00
9. concentration 46.65% volume: 50.00
10. concentration 46.65% volume: 45.00
11. concentration 46.65% volume: 40.00
12. concentration 46.65% volume: 35.00
13. concentration 46.65% volume: 30.00
14. concentration 46.65% volume: 25.00
15. concentration 46.65% volume: 20.00
16. concentration 46.65% volume: 15.00
17. concentration 46.65% volume: 10.00
18. concentration 46.65% volume: 5.00



ps-the values ​​that you make, do not correspond to the results of your formula, because in your post, you used approximations wrong.
Last edited on
THX if fix the problem but how can i make the volume 0? also how can i limit the volume input by only divisible by 5?

THANK YOU
can you be more
clear?

have these results mean?


Please enter volume: 
0. concentration 100.00% volume: 50.00
1. concentration 90.91% volume: 50.00
2. concentration 82.64% volume: 50.00
3. concentration 75.13% volume: 50.00
4. concentration 68.30% volume: 50.00
5. concentration 62.09% volume: 50.00
6. concentration 56.45% volume: 50.00
7. concentration 51.32% volume: 50.00
8. concentration 46.65% volume: 50.00
9. concentration 46.65% volume: 40.00
10. concentration 46.65% volume: 32.00
11. concentration 46.65% volume: 25.60
12. concentration 46.65% volume: 20.48
13. concentration 46.65% volume: 16.38
14. concentration 46.65% volume: 13.11
15. concentration 46.65% volume: 10.49
16. concentration 46.65% volume: 8.39
17. concentration 46.65% volume: 6.71
18. concentration 46.65% volume: 5.37
19. concentration 46.65% volume: 4.29
20. concentration 46.65% volume: 3.44
21. concentration 46.65% volume: 2.75
22. concentration 46.65% volume: 2.20
23. concentration 46.65% volume: 1.76
24. concentration 46.65% volume: 1.41
25. concentration 46.65% volume: 1.13
26. concentration 46.65% volume: 0.90
27. concentration 46.65% volume: 0.72
28. concentration 46.65% volume: 0.58
29. concentration 46.65% volume: 0.46
30. concentration 46.65% volume: 0.37
31. concentration 46.65% volume: 0.30
32. concentration 46.65% volume: 0.24
33. concentration 46.65% volume: 0.19
34. concentration 46.65% volume: 0.15
35. concentration 46.65% volume: 0.12
36. concentration 46.65% volume: 0.10
37. concentration 46.65% volume: 0.08
38. concentration 46.65% volume: 0.06
39. concentration 46.65% volume: 0.05
40. concentration 46.65% volume: 0.04
41. concentration 46.65% volume: 0.03
42. concentration 46.65% volume: 0.03
43. concentration 46.65% volume: 0.02
44. concentration 46.65% volume: 0.02
45. concentration 46.65% volume: 0.01
46. concentration 46.65% volume: 0.01
47. concentration 46.65% volume: 0.01
48. concentration 46.65% volume: 0.01
49. concentration 46.65% volume: 0.01
50. concentration 46.65% volume: 0.00
51. concentration 46.65% volume: 0.00
52. concentration 46.65% volume: 0.00
53. concentration 46.65% volume: 0.00
54. concentration 46.65% volume: 0.00
55. concentration 46.65% volume: 0.00


or are looking for a quantity of volume which leaves unchanged the concentration?
Last edited on
Topic archived. No new replies allowed.