Upload
-
View
755
Download
0
Embed Size (px)
Citation preview
C#
04/09
: SUZUSIME
ID: suzusime
KMC slack bot
root
ID
※
?
C#
Monogame
PC
1. Visual Studio Community 2015
2. Monogame
Slack
Slack #csgame
……
Project
巫女さんSTG
3D
RPG
FPS 3D 3D
AI ……
2D
……
3
……
2
Id: hakurin
C# Visual Studio
Ideone
public class Test {
public static void Main(){
System.Console.WriteLine("Hello, World!");
}
}
“ideone it!”
Output “Hello, world!” OK
Compile Error!
“Hello, world!”
2 2
public static void Main(){
System.Console.WriteLine("Hello, World!");
System.Console.WriteLine("ほぇ~");
}
public class Test {
public static void Main(){
System.Console.WriteLine("Hello, World!");
System.Console.WriteLine("ほぇ~");
}
}
public class Test {
public static void Main(){
System.Console.WriteLine("Hello, World!");
System.Console.WriteLine("ほぇ~");
}
}
System.Console.WriteLine("Hello, World!");
System.Console.WriteLine("ほぇ~");
2
System.Console.WriteLine();
Main() {}
Main()
int num;
num = 28;
System.Console.WriteLine(num);
28
int num;
int num
int
num
num = 28;
num 28
=
int a, b;
a = 28;
b = a;
a = a + 87;
=
int
整数型 int
実数型 float, double
文字列型 string
真理値型 bool
double x;
x = 1.2;
x = x*x;
string str;
str = "ゆゆ式";
str = str + "!";//strの中身は「ゆゆ式!」に
+
int num = 28;
int a;
a = 8;
if(a>3){
Console.WriteLine("にゃー");
}
if {}
int a = 8;
if(a>3){
Console.WriteLine("にゃー");
} else {
Console.WriteLine("ぴょんぴょん");
}
else if
while
int i;
i = 0;
while(i<5){
Console.WriteLine("にゃー" + i);
i++;
}
(i<5)
for
for(int i=0; i<5; i++){
Console.WriteLine("にゃー" + i);
}
()
1.
2.
3. 1
int[] retsu;
retsu = new int[3];
retsu[0]=4; retsu[1]=5; retsu[2]=1;
retsu int 3
[0],[1]
int[] retsu;
restu = new int[] {4, 5, 1};
int[] retsu = new int[] {4, 5, 1};
for(int i=0; i<3; i++){
System.Console.WriteLine(i+":"+retsu[i]);
}
for
//これは点数の一覧の配列
int[] retsu = new int[] {4, 5, 1};
/* バグが出る for(int i=0; i<3; i++){
Console.WriteLine(i + "=" + retsu[i]);
} */
//
/* */
3
retsu
1.
2.
3.
4.
string str = "ムカデは好みません";
System.Console.WriteLine(str);
string str;
str = System.Console.ReadLine();
//入力した文字がstrに入る
System.Console.ReadLine() string
string str;
str = System.Console.ReadLine();
int num;
num = int.Parse(str);
+
C#
int num;
num = 4+7;//11 たし算(加算)
num = 4-7;//-3 ひき算(減算)
num = 4*7;//28 かけ算(乗算)
num = 49/5;//9 割り算の商
num = 49%5;//4 割り算の余り(剰余)
int a = 7;
bool b;//真理値を入れる型
b = 2==a;//等号が成り立つか否か
b = 2!=a;//不等号が成り立つか否か(not equal)
b = a>2;//不等号が成り立つか否か
b = a>=2;//不等号が成り立つか否か
b = a<2;//不等号が成り立つか否か
b = a<=2;//不等号が成り立つか否か
if(true){
Console.WriteLine(num);//エラー
int num=88;
Console.WriteLine(num);//大丈夫
}
Console.WriteLine(num);//エラー
if(true){
Console.WriteLine(num);//エラー
int num=88;
Console.WriteLine(num);//大丈夫
}
Console.WriteLine(num);//エラー
C#
int, long, short, sbyte, uint, ulong, ushort,
byte
bit byte
bit 1bit 0 1 2
2bit 00 01 10 11
4
1byte=8bit
1byte 2 8 256
sbyte, short, int, long
sbyte 1byte -128 127
short 2byte -32,768 32,767
int 4byte -2,147,483,648 2,147,483,648
long 8byte -9,223,372,036,854,775,808 9,223,372,036,854,775,807
byte, ushort, uint, ulong
byte 1byte 0 255
ushort 2byte 0 65,535
uint 4byte 0 4,294,967,295
ulong 8byte 0 18,446,744,073,709,551,615
float double double
int double
CPU
CPU
1bit
2
double 2
0.1
==
if while for
bool
int a = 1;
bool result = (a<3);
if(result){
System.Console.WriteLine("ちっちゃい!");
}
switch
int a=1; int b;
switch(a){
case 0:
b=-10; break;
case 1:
b=6; break;
default:
b=0; break;
}
do while foreach
foreach for
…
https://paiza.jp/poh/ando( )
http://judge.u-
aizu.ac.jp/onlinejudge/finder.jsp?course=ITP1
4 23
4 16 TOEFL
slack #csgame