Q:

calc

//Javascript Calculator

var a = prompt('Number #1')
var b = prompt('Number #2')
var c = a+=b
alert(c)
4
ok I'll stop cheating thank you
5
body {
  width: calc(100vw - 8px);
  height: calc(100vh - 8px);
}
1
calc_type = input('Would operation would you like to do (+, -, *, /)?: ')
print('\n')
num1 = int(float('Enter first number: '))
num2 = int(float('Enter second number: '))

if calc_type == '+':
  answer_a = num1 + num2
  print('\n:', num1, '+', num2, '=', answer_a)
elif calc_type == '-':
  answer_s = num1 - num2
  print('\n:', num1, '-', num2, '=', answer_s)
elif calc_type == '*':
  answer_m = num1 * num2
  print('\n:', num1, '+', num2, '=', answer_m)
elif calc_type == '/':
  answer_d = num1 / num2
  print('\n:', num1, '/', num2, '=', answer_d)
else:
  print('\nInvalid Input!')
26
def add(a, b):
  return a + b

def subtract(a, b):
  return a - b

def multiplication(a, b):
  return a * b

def division(a, b):
  return a / b
3
shut up guys im just trying to do my science homework!!!!
7
#include <iostream>
#define LOG(x) std::cout << x << std::endl

struct BadGamer{
  void BAD(){
  	LOG("Uses Calculator and is Bad at games");
  }
};
struct GoodGamer{
  void GOOD(){
  	LOG("Doesn't use Calculator and is Good at games");
  }
};

int main(){
  int rep;
  LOG("Do you Use calculator");
  std::cin >> rep >> std::endl;
  if(rep == 1){
  	BadGamer.BAD();
  }
  if(rep == 0){
  	GoodGamer.GOOD();
  }else{
    std::cout << "BRUUH" std::endl;
  }
}
1
String uncool = "dude, uncool."; //when you're in class
0

New to Communities?

Join the community