31 Comments

  1. Comparisons like that really bug me because they don't reflect reality. They point out that "Hello, World" takes one line in Python but seven in C++—a sevenfold difference that looks huge and scary—yet if you write "Hello, World" a thousand times without loops, it takes 1,000 lines in Python versus 1,007 in C++, making the difference negligible.

  2. The code from C++ is written std::cout<<"Hello,World!"; but at the top it is made using namespace std; it could have been cout<<"Hello,World!";

  3. import java.util.InputMismatchException;
    import java.util.Scanner;
    public class calculator {
    public static void main(String[] args) throws InterruptedException {
    Scanner cin = new Scanner(System.in);
    boolean yh = false;
    outer:
    while (true) {
    System.out.print("33[2J33[1;1H");
    System.out.println("welcome to meth calculator it is a non scientific calculator that can only handle a number then a operator then a numbernnchoose a number");
    double y;
    double x;
    try {
    x = cin.nextDouble();
    cin.nextLine();
    }
    catch (InputMismatchException e) {
    System.out.println("please only enter numbers");
    System.out.flush();
    cin.nextLine();
    Thread.sleep(2000);
    continue outer;
    }
    System.out.print("nchoose operator * + – ÷ ^ or say √ for square rootn");
    String operat = cin.nextLine();
    operat = operat.trim();
    if (!operat.equals("/") && !operat.equals("÷") && !operat.equals("*") && !operat.equals("×") && !operat.equals("-") && !operat.equals("+") && !operat.equals("√") && !operat.equals("^")) {
    System.out.println("invalid operator");
    Thread.sleep(2000);
    System.out.print("33[H33[2J");
    System.out.flush();
    continue outer;

    }
    if (!operat.equals("√")) {
    System.out.print("nchoose another numbern");
    System.out.flush();
    try {
    y = cin.nextDouble();
    }
    catch (InputMismatchException e) {
    System.out.println("please only enter numbers");
    System.out.flush();
    cin.nextLine();
    Thread.sleep(2000);
    continue outer;
    }
    if (operat.equals("+")) {
    System.out.print("33[2J33[1;1H");
    System.out.println(x + y);
    }
    else if (operat.equals("-")) {
    System.out.print("33[2J33[1;1H");
    System.out.println(x – y);
    }
    else if (operat.equals("*") || operat.equals("×")) {
    System.out.print("33[2J33[1;1H");
    System.out.println(x * y);
    }
    else if (operat.equals("/") || operat.equals("÷")) {
    System.out.print("33[2J33[1;1H");
    System.out.println(x / y);
    }
    else if (operat.equals("^")) {
    System.out.print("33[2J33[1;1H");
    System.out.print(Math.pow(x, y));
    }
    else if (operat.equals("√")) {
    System.out.print("33[2J33[1;1H");
    System.out.print(Math.sqrt(x));
    }
    return;
    }
    break;
    }
    }

    }

    String Java = "easy";

Leave a Reply

Your email address will not be published. Required fields are marked *

You might like

© 2026 Cantinho do Vídeo - WordPress Video Theme by WPEnjoy