Caught Speeding

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.
We are not a homework service. If you want to learn programming, make a plan and start writing some code and if you get stuck you can get help.

If you don't want to learn better go to:
https://www.assignmentexpert.com/blog/do-my-c-homework/
http://www.tutorsonnet.com/c++-programming-homework-help.php
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
Thanks Ganado! I had no idea what the hell I was doing! I appreciate the help!
Topic archived. No new replies allowed.