zoukankan      html  css  js  c++  java
  • A+B问题通解_Pascal_C++_Java

      世界不断发展,各种电子设备不断变得更加迷你,代码却越写越长……

      A+B Problem

      Input:Two integer A,B

      Output:The ans of A+B

      1971年,Niklaus Wirth 发明 Pascal

      越是早年的语言,内存与运行时间越少,代码也越简单

    1 var a,b:longint;
    2 begin
    3     readln(a,b);
    4     writeln(a+b)
    5 end.

      1983 年 C++ 在 Bjarne Stroustrup 手中诞生

      主要特点是尽量兼容C,且支持面向对象

    1 #include<iostream>
    2 using namespace std;
    3 int main()
    4 {
    5     int a,b;
    6     cin>>a>>b;
    7     cout<<a+b;
    8     return 0;
    9 }

      1995 年 Sun Microsystems 通过改进 C++ 发明了 Java

      不难看出 Java 有很多与 C++ 相似的地方

     1 import java.util.Scanner;
     2 public class Main
     3 {
     4     public static void main(String[] args)
     5     {
     6         Scanner in=new Scanner(System.in);
     7         int a=in.nextInt();
     8         int b=in.nextInt();
     9         System.out.println((a+b));
    10     }
    11 }

      重点是代码长度从 5行→9行→11行

      设想 N 年后的代码,会是多少行?

      (不过 Python 成功打破了这一规律)

  • 相关阅读:
    Elasticsearch 安全功能现免费提供(从 6.8.0 和 7.1.0 版本开始)
    redis5.0.0安装
    java归并排序
    java Shell排序
    java折半插入排序
    java插入排序
    java快速排序
    Android onSaveInstanceState()
    Android Intent传递数据
    Android Intent的花样启动
  • 原文地址:https://www.cnblogs.com/hadilo/p/5956855.html
Copyright © 2011-2022 走看看