Dec 1, 2017 at 7:52pm UTC
You are driving a little too fast, and a police officer stops you. Write code to compute the result. If speed is 60 or less, the output is no ticket. If speed is between 61 and 80 inclusive, the output is small ticket. If speed is 81 or more, the output is big ticket.
i need help programming this.
Dec 1, 2017 at 11:42pm UTC
i got u fam
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
#include <iostream>
#include <algorithm>
int main()
{
std::cout << "How fast were you going? " ;
int n = 0;
std::cin >> n;
n = static_cast <int >(0.00041489577087 * n * n +
-0.00891519935236 * n + 0.00000000000042);
std::cout << "\n" ;
for (int i = 0; i < n * 2; i++)
{
for (int j = 0; j < n * 3 * 6; j++)
std::cout << "#" ;
std::cout << "\n" ;
}
for (int i = 0; i < std::min(n, 1); i++)
{
std::cout << "## TICKET " ;
for (int j = 1; j < n * 3 * 6 - 9; j++)
std::cout << "#" ;
std::cout << "\n" ;
}
for (int i = n * 2 + 1; i < n * 2 * 2; i++)
{
for (int j = 0; j < n * 3 * 6; j++)
std::cout << "#" ;
std::cout << "\n" ;
}
std::cout << std::flush;
return 0;
}
Last edited on Dec 2, 2017 at 12:05am UTC
Dec 4, 2017 at 6:14am UTC
Thanks Ganado! I had no idea what the hell I was doing! I appreciate the help!