Jump to content
MakeWebGames

ChatGPT


peterisgb

Recommended Posts

What are your thoughs and opinions about this?
Like i decided at long last to try it out and see what it can do and i managed to get it to make this....
 

<!DOCTYPE html>
<html>
<head>
	<title>Calculator</title>
	<style>
		body {
			font-family: Arial, sans-serif;
			background-color: #f2f2f2;
		}
		
		.container {
			margin: 50px auto;
			padding: 20px;
			background-color: #fff;
			box-shadow: 0px 0px 10px #ccc;
			border-radius: 10px;
			text-align: center;
			width: 300px;
		}
		
		h1 {
			margin-top: 0;
			font-size: 36px;
			color: #333;
		}
		
		input {
			display: block;
			margin: 10px auto;
			padding: 10px;
			border: none;
			background-color: #f2f2f2;
			width: 80%;
			border-radius: 5px;
			font-size: 18px;
			text-align: right;
		}
		
		.button-container {
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			margin: 10px auto;
			width: 80%;
		}
		
		button {
			padding: 10px 20px;
			border: none;
			background-color: #333;
			color: #fff;
			font-size: 18px;
			border-radius: 5px;
			cursor: pointer;
		}
		
		button:hover {
			background-color: #555;
		}
		
		button:active {
			transform: translateY(2px);
		}
	</style>
</head>
<body>
	<div class="container">
		<h1>Calculator</h1>
		<input type="text" id="result" disabled>
		<div class="button-container">
			<button onclick="clearScreen()">C</button>
			<button onclick="backspace()">BACK</button>
			<button onclick="insert('+')">+</button>
			<button onclick="insert('-')">-</button>
			<button onclick="insert('*')">*</button>
			<button onclick="insert('/')">/</button>
			<button onclick="insert('7')">7</button>
			<button onclick="insert('8')">8</button>
			<button onclick="insert('9')">9</button>
			<button onclick="insert('4')">4</button>
			<button onclick="insert('5')">5</button>
			<button onclick="insert('6')">6</button>
			<button onclick="insert('1')">1</button>
			<button onclick="insert('2')">2</button>
			<button onclick="insert('3')">3</button>
			<button onclick="insert('0')">0</button>
			<button onclick="calculate()">=</button>
		</div>
	</div>
	<script>
		function insert(num) {
			document.getElementById("result").value += num;
		}

		function clearScreen() {
			document.getElementById("result").value = "";
		}

		function backspace() {
			var input = document.getElementById("result");
			input.value = input.value.slice(0, -1);
		}

		function calculate() {
			var input = document.getElementById("result");
			var result = eval(input.value);
			document.getElementById("result").value = result;
		}
	</script>
</body>
</html>

TBH i'm pretty amazed that it was able to produce this and actually work.... Where could this go. Could we ALL be out of jobs?

Link to comment
Share on other sites

welcome to the dark side 🙂 been using it myself as well as github co pilot. Has helped me loads when having to fix or bug test my amazing code haha.
Feel that co-pilot has helped speed up writing code.
I don't think it'll be to long before all developers/coder or whatever will be using AI.

Edited by corruptcity || skalman
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...