码迷,mamicode.com
首页 > 编程语言 > 详细

linux下c++/go/c#/java学习例子

时间:2019-09-28 13:10:32      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:tran   utc   apt   gnu   https   post   code   evel   tee   

代码例子已托管到svnserve
20190928添加:
cpptest - Revision 1: /  https://svnserve.com/cpptest/
apt install subversion
root@iZ8vb0mp96vvgq12ksoizhZ:/home/hxh/cpptest# svn --version
svn, version 1.9.7 (r1800392)
   compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
svn checkout https://svnserve.com/cpptest --username Ivanhan2019
mv cpp/* cpptest
cd cpptest
svn add *
svn commit -m "cpptest"

CentOS 7下安装Mono
su -c ‘curl https://download.mono-project.com/repo/centos7-stable.repo | tee /etc/yum.repos.d/mono-centos7-stable.repo‘
yum install mono-devel
[root@localhost ~]# mono --version
Mono JIT compiler version 6.4.0.198 (tarball Mon Sep 23 20:53:41 UTC 2019)
[root@localhost ~]# yum install subversion
[root@localhost ~]# svn --version
svn, version 1.7.14 (r1542130)
   compiled Apr 11 2018, 02:40:28
[root@localhost cstest]# ls
Hello.cs
[root@localhost cstest]# mcs Hello.cs
[root@localhost cstest]# ls
Hello.cs  Hello.exe
[root@localhost cstest]# mono Hello.exe
3
5
[root@localhost cstest]# vi Hello2.cs
[root@localhost cstest]# ls
Hello2.cs  Hello.cs  Hello.exe
[root@localhost cstest]# mcs Hello2.cs
[root@localhost cstest]# ls
Hello2.cs  Hello2.exe  Hello.cs  Hello.exe
[root@localhost cstest]# mono Hello2.exe
1 man
[root@localhost cstest]# svn diff Hello.cs
Index: Hello.cs
===================================================================
--- Hello.cs(revision 2)
+++ Hello.cs(working copy)
@@ -1,5 +1,5 @@
 using System;
-//第一个C#程序“Hello World!”
+// 第一个C#程序
 namespace HelloWorld
 {
 class Hello 
@@ -16,4 +16,4 @@
 Console.WriteLine(shapes[3].Length);//5 
 }
 }
-}
\ No newline at end of file
+}
[root@localhost cstest]# svn commit -m "modify *.cs by unix2dos" Hello.cs
Sending        Hello.cs
Transmitting file data .
Committed revision 3.
[root@localhost cstest]# svn status
?       Hello2.cs
?       Hello2.exe
[root@localhost cstest]# svn add *
A         Hello2.cs
A  (bin)  Hello2.exe
[root@localhost cstest]# svn ci -m ""
Adding         Hello2.cs
Adding  (bin)  Hello2.exe
Transmitting file data ..
Committed revision 4.
 
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest# go version
go version go1.12.1 linux/amd64
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest# svn --version
svn, version 1.9.7 (r1800392)
   compiled Mar 28 2018, 08:49:13 on x86_64-pc-linux-gnu
root@dthero_cn:/home/yiyou/gopath# cd /home/yiyou/gopath/cpptest/gotest/jiekou1
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest/jiekou1# ls
jiekou1.exe  jiekou1.go
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest/jiekou1# go build
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest/jiekou1# ls
jiekou1  jiekou1.exe  jiekou1.go
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest/jiekou1# ./jiekou1
Hello!
你好!
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest/jiekou1# cd ..
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest# svn status
?       jiekou1
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest# svn add jiekou1
A         jiekou1
A  (bin)  jiekou1/jiekou1
A  (bin)  jiekou1/jiekou1.exe
A         jiekou1/jiekou1.go
root@dthero_cn:/home/yiyou/gopath/cpptest/gotest# svn ci -m "golang test"
Adding         jiekou1
Adding  (bin)  jiekou1/jiekou1
Adding  (bin)  jiekou1/jiekou1.exe
Adding         jiekou1/jiekou1.go
Transmitting file data ...done
Committing transaction...
Committed revision 6.
 
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# apt install openjdk-11-jre-headless
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# java --version
openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)


root@dthero_cn:/home/yiyou/gopath/cpptest/javatest#apt install openjdk-11-jre-headless
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# file Int2Str.java
Int2Str.java: C source, ISO-8859 text, with CRLF line terminators
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# cp Int2Str.java Int2Str.temp;iconv -f gbk -t utf-8 Int2Str.temp -o Int2Str.java
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# ls
Int2Str.java Int2Str.temp IP2Long.java
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# file Int2Str.java
Int2Str.java: C source, UTF-8 Unicode text, with CRLF line terminators
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# javac Int2Str.java
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# ls
Int2Str.class Int2Str.java Int2Str.temp IP2Long.java
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# java Int2Str
黄宝石 的整数形式为:5
整数2转化成字符串:战士
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# svn add Int2Str*
A (bin) Int2Str.class
A Int2Str.java
A Int2Str.temp
root@dthero_cn:/home/yiyou/gopath/cpptest/javatest# svn ci -m "java test"
Adding (bin) Int2Str.class
Adding Int2Str.java
Adding Int2Str.temp
Transmitting file data ...done
Committing transaction...
Committed revision 7.

 
 

linux下c++/go/c#/java学习例子

标签:tran   utc   apt   gnu   https   post   code   evel   tee   

原文地址:https://www.cnblogs.com/Ivanhan2019/p/11602480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!