Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //0. вход
- //1. обем на аквариума = дължина * широчина * височина -> куб. см
- //2. превръщаме обема от куб. см към литри
- //3. обем на заетата част -> процент е зает -> процент в число -> / 100 или * 0.01
- //4. обем на свободната част = обем в литри * (1 - процент в число)
- int lenght, width, height;
- cin >> lenght >> width >> height;
- double percent;
- cin >> percent;
- int volume = lenght * width * height; //куб.см
- double volumeLiters = volume * 0.001; //куб.см / 1000 -> литри
- double numberPercent = percent / 100; //* 0.01
- double volumeFreeSpace = volumeLiters * (1 - numberPercent);
- cout.setf(ios::fixed);
- cout.precision(2);
- cout << volumeFreeSpace << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement