Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

५✍

10.25 본문

비트 단기/c

10.25

suuuuu 2018. 10. 25. 20:04
https://colorscripter.com/

 

ctrl + d (줄에있는거 증가)

crrl + x (줄에있는거 감소)

ctrl + home (줄앞까지 커서)

crrl + x (줄끝까지 커서)



type 

1. char

2. short

3. long


두가지 상태를 가질때 bit라고 한다.


8bit = 1byte

short =2byte


2^10 =1024

1024byte = 1K

1024K =1Mbyte


2^8 = 256

2^10 = 1024

2^16 = 6XXXX

2^32 =40억






------------------------------------------------------------------------------------


#include "pch.h"
#include <iostream>
int main()
{
/*
if (5 < 3)
{
printf("1\n");
}
else if (4!=4)
{
printf("2\n");
}
else
{
printf("3\n");
}
*/
/*
char num = 100;
if (num >= 90)
{
printf("당신의 성적은A입니다.\n");
}
else if(num>=80)
{
printf("당신의 성적은B입니다.\n");
}
else if (num >= 70)
{
printf("당신의 성적은C입니다.\n");
}
else
{
printf("당신의 성적은D입니다.\n");
}
*/
/*
short a = 30;
printf("%d\n", a);
short b;
b = 100; //변수를 두줄로 처리함
printf("%d\n", b);
b = a; //b의값을 a값으로 변함
printf("%d %d\n", a,b);
b = b * a; //b의값을 b*a값으로 변함
printf("%d %d\n", a, b);
a++; // a+1
printf("%d %d\n", a, b);
b--; //a-1
printf("%d %d\n", a, b);
a = a + 1; //a+1 (a++보다 속도가 빠름)
printf("a=%d\n", a);
a = -a;
b = b - 1; //b-1 (b--보다 속도가 빠름)
printf("b=%d\n", b);
b += 2; //b=b+2
printf("%d %d\n", a, b);
a -= 10;//a=a-10
printf("%d %d\n", a, b);
*/
/*
long a = 10;
long b = 20;
printf("%d %d\n", a, b);
long temp = a;
a = b;
b = temp;
printf("%d %d\n", a, b);
//교환프로그램, swap프로그램 이라고 한다.
*/
/*
short a = 10;
long b = 20;
a = b;
printf("%d %d\n", a, b);
//작은거에 큰게 들어가는 셈
b = a;
printf("%d %d\n", a, b);
//type 1. char 2. short 3. long
//두가지 상태를 가질때 bit라고 한다.
//8bit = 1byte
//short =2byte
a = (short)b;
//b는 short형태로 강제된다.
//타입캐스팅 이라고 한다.
short a = 10;
long b = 30;
a = (short)b;
b = a;
*/
//반복문
/*
for (short i = 0; i < 6; i++)
{
printf("호랑이 %d마리\n",i+1);
}
*/
/*
for (int i= 0; i < 10; i++)
{
printf("8*%d = %d\n", i, i * 8);
}
*/
/*
for (int i = 1; i <= 5; i++)
{
printf("호랑이\n");
}
*/
/*
long s=0;
for (long i = 1; i <= 52000; i++)
{
s = s + i;
printf("%d번째 %d\n",i, s);
}
*/
/*
for (long i = 0; i <3; i++)
printf("호랑이\n");
//한문장일경우 생략가능
//for문 맨끝에 ;붙이면 안됨
*/
/*
for (short i = 0; i < 10; i++)
{
if (i%2==0)
{
printf("%d는 짝수입니다.\n", i);
}
else
{
printf("%d는 홀수입니다.\n", i);
}
printf("호랑이\n\n");
}
*/
}


'비트 단기 > c' 카테고리의 다른 글

10.29  (0) 2018.10.29
10.24  (0) 2018.10.26
과제  (0) 2018.10.26
10.23  (0) 2018.10.23
10.22  (0) 2018.10.22