U E D R , A S I H C RSS

새싹교실/2012/주먹밥


1.


06
12
12
12

2.

3/21 3/28 4/3,4보 4/5 4/11 4/16
O O O O O O
O O O X O X
O O X O X O
O O X O X O

3.

  • : 물 3 . C . +@

  • : + , 밍, 만들.
  • : c , 만들 .
  • : .

4.


4.2. 1(2012/3/21)




  • Linux GCC를
  • Wiki
  • (?)

4.2.1.


  • : . , 는 동 는데 . , . wiwki , 느낀 . Virtual Box. Hello World 는데 보는 . 는데. .
  • : " " . 면 무 는데 . 3대를 wiki 를 들. . 리눅 . . 뵙는데 . 먼 는데.. . .

  • : (208-216) , , 3 21 PM6 gcc, Linux, android example, wiki. .

  • :, , . . 러내 모르는럼 들. , . . 2 .

4.3. 2(2012/3/28)


4.3.2.


  • : 6 PC 6

    /2012//2
    /2011/무/벨4

  • 2

  • Linux gedit를 .

    • 됨 -

  • 는 방 . 몇번 몇번 ? , . .

  • -> 는 C 미리 . .


  • printf(), scanf() ?


  • int, char, float, long, double 변는 무 만들 . , 문, . ?


  • #define . #define 를 만들 ? .


  • 는 뭐 . math.h . time.h .srand(time(NULL)) .

  • if문, switch()case: default:}, for, while문 . 말 만들 . switch case문 break를 :(

  • 는 ACM 문

4.3.3.


  • -


#include<stdio.h>
int main() {

int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);

if(a>b) {
	d=b;
	b=a;
	a=d;
}
if(b>c) {
	d=c;
	c=b;
	b=d;
}
if(a>b) {
	d=b;
	b=a;
	a=d;
}
printf("%d %d %d",a,b,c);

return 0;

}

  • -


#include <stdio.h>

int main(void)
{
	int num;

	printf("Input integer.");
	scanf("%d", &num);

	if(num % 400 == 0)
		printf("Leap");
	else if((num % 4 == 0) || (num & 100 != 0))
		printf("Leap");
	else
		printf("Normal");

	return 0;
}

  • -


#include<stdio.h>
int main()
{
	int a,b,c;
	int d;

	scanf("%d %d %d",&a,&b,&c);

	if(a>b)
	{	
		d=b;
		b=a;
		a=d;
	}
	if(b>c)
	{	d=c;
		c=b;
		b=d;
	}
	if(a>b)
	{
		d=b;
		b=a;
		a=d;
	}
	
	if(a==b || a==c || b==c )
	{
		printf("Impossible");
	}
	else printf("%d %d %d",a,b,c);

	return 0;
}		

4.3.4. 2

  • -

#include<stdio.h>
int main(void)
{
	unsigned int y;
	scanf("%u",&y);
	if(y%400==0) {
		printf("Leap\n");
		return 0;
	}
	if(y%100==0) {
		printf("Normal\n");
		return 0;
	}
	if(y%4==0){
		printf("Leap\n");
        }
        printf("Normal\n");
	return 0;
}





  • -

#include<stdio.h>

int main()
{
 long long n;
 bool t = 0; 

 scanf("%lld",&n);
 
 if(n%4==0)
 {
  t = 1;
  if(n%100 == 0)
  {
   t = 0;
   if(n%400 == 0)
   { 
    t = 1; 
   }     
  }
 }
 if(t)
 { 
  printf("Leap");
 }
 else
 {
  printf("Normal");
 }
 return 0;
}

4.4. 3(4/3, 4/4 )


  • Ice Breaking

4.4.1. ICE breaking


  • - . . 1 내내. . map editor만 . 빡. . C는 . 는데 . . . 돼 .

  • - . 남. . 는 MT를 . . . . . . 매. . . *^^*

  • - 는데 데 . 보냈. . 리를 는데 를 배. 를 봐. 빛 리더 . 24 10 듬. ~ 4 =ㅂ= !!!! 뭐 4 . . !

4.4.3.1. (2012/4/3, 4/4)

  • - C. 냐. 만들. 만들 . int는 , char는 문, float는 . ? 만들. 0 1?

  • if문

   int a = 5;
   if(a >3){
      printf("a 3보 .\n");
   }
   else printf("면 말.\n");
  • for문

   for(1번,2번,4번){
       3번들;
   }

   for(i = 0;i<5;i++){
   }

  • while문

    a = 5;
    while(a>3){
        a--;
    }
    printf("%d",a);


  • +-*/% ||&& != == <= >= ~^&| ++i i++
    • +-*/%
    • || && 논리 : ||는 &&는
    • != == <= >= :
    • ~^&| : char 1byte -> 8bit ~ 0 1 ^는 르면 &는 1 1 |는 만 1 1 .
    • ()를 바뀌는
    • ++i i++는 i = i +1; 른 명 를 보.

  • : .
  • : 변는 메모리 는데 int는 4byte (address).
  • : 는 32bit 4byte 64bit 8byte . (void *), (int *), (float *) 모. int *a는 4byte를 a(address) . (*)를 붙 . int 4byte만 ?
  • C는 Call-by-value를 . .
  • Call-by-value, Call-by-reference


#include<stdio.h>

void swap(int a, int b){
   int temp;
   temp = a;
   a = b;
   b = temp;
}

void swap2(int *a, int *b){
   int temp;
   temp = *a;
   *a = *b;
   *b = *temp;
}

int main(){
   int i=3,j=5;

   swap(i,j);
   printf("%d %d\n",i,j);
   swap2(&i,&j);
   printf("%d %d\n",i,j);
   return 0;
}

  • Call-by-reference를 . !
  • 더불 따른 (naming). !
  • (array)는 int a[10];면 a는 int 10 0~9 (index)를 .
    • a . scanf("%d",a); a[0] .
    • a[2] *(a+2)

  • typedef
    • 만들 !
    • typedef는 typedef ; .

///typedef를 
typedef struct _CALORIE{
	char name[40];
	float value;
}CALORIE;

CALORIE myfood;

    CALORIE 

  • - 른변 Call-by-value Call-by-reference방 .

 valuefunc(myfood);
 referencefunc(&myfood);


    • 른 모 부릅.

CALORIE a;
CALORIE *b = &a;

scanf("%s, %f",a.name,&(a.value)); //a.name  a.value   !    .
printf("%s %.2f\n",a.name,a.value); //냥 불러
printf("%s %.2f\n",b->name,b->value); //-> 불러




///pcal  40   받는 .
///num .
float calcalc(CALORIE *pcal, int num){
	char name[40];
	float gram = 0;
	float totalcal = 0.0;
	int i;
	printf("-- 람 -------------\n");
	for(i = 0; i<num;i++) // 
		printf("%s\t", (pcal+i)->name); //. 
	printf("\n----------------------------------------\n");
	while(1){
		printf("명(end를 .) : ");
		scanf("%s", name);
		if(strcmp(name, "end") == 0)
			break;
		printf(" : ");
		scanf("%f", & gram);
		for(i=0;i<num;i++){
			if(strcmp(name, (pcal+i)->name) == 0){
				totalcal += (pcal+i)->value * gram /100.0;
				break;
			}
		}
	}
	return totalcal;
}	

4.4.3.2. (2012/4/8)




  • 명 - .
  • 는 변 ?

#include<stdio.h>

int func(){
   return 0;
}

int main(){
   printf("%d\n",func(1,2,3,4)); 
   return 0;
}


4.4.3.3.


4.5. 4(2012/4/11)

4.5.1.



  • 메모리( )
    • . *(:Pointer) FILE 를 메모리 . (File) 메모리 C 브러리를 보를 FILE 를 불러. 리는 *를 FILE 보를 . Good Good!
    • 는 대략 . , , , . http://winapi.co.kr/clec/cpp2/17-2-1.htm .
    • . ''는 브를 . C:\\Desktop\test.txt 불러. 불러? C:\\Desktop\리\test.txt txt ? ? 는데. ? . .\test.txt 는 test . ..\test.txt 는 바 더를 . 더는 ? .\리\test.txt . .
    • .
    • stdin, stout. . fprintf print 를 보.

#include <stdio.h>

int main(){
   int a;
   fprintf(stdout,"%d",5);
   printf("%d",5);
   fscanf(stdin,"%d",&a);
   scanf("%d",&a);

   return 0;
}


  • > 돌릴 . test.exe 면 5를
    CMD test.txt

 test.exe > test.txt
면 test.txt 는 5.


  • Git Repository를 만들 Readme .

4.5.2. ,


  • .
  • .
  • iOS . .
    • 뭐 배? -
  • 램 봐.
    • Scroll 는데 %를
    • (x/) * 100 는데 됨. int 0 . (float)(x/) * 100 .

4.6. 5(2012/4/18)


4.6.1. ,


  • 문 : -> . .
    • 변 : 만 많 . . 를 들면 . 는 僞! (僞)는 (惡) . (惡) () . 말란 . ( ). 몸냐 마냐를 . 보면 . 면 Just do it! . . 능 . . Whatever! 보는 . .

  • 문 : -> OOP란 무?
    • 변 : 밍(Object Oriented Programming). . 리는데 . 면 API를 . Class를 . C++ Java Class를 Class를 람들. ... . . C Class란 . . .

  • 문 : , -> ?
    • 변 : 1 는 배 는 미 . 1 는 배 돌리면 ? 뻗는 를 못? . C는 메모리 머는 를 못. 메모리 .

  • 문 : , -> ?
    • 변 : Windows API를 는데 30 ? . javascript alert(5)를면? 딱 ? ~~ ?



  • SVN
  • 램 봐
    • for문 리는데 for문 for문 . .
    • if문 0 면 0 . !

4.7. 5 23


  • 만들! .

4.7.1.



<html>
<head>
<script language = "javascript">

left = 10;

function key(){
	var image=document.getElementById("demo");
	image.style.position="absolute";
	
	alert(left);
	left += 1;
	image.style.left = left; //  left를 바  냐면. left 대문.
	//image.style.left=(left+1)+'px';
	//var l=document.getElementById("demo").style.left += 1;
	
}
	
</script>

</head>

<body onKeyDown='key();'>

<img src = "1.jpg" id="demo" top = 10 left = 10>


</body>
</html>

4.7.2.


  • 는 javascript를

4.7.3.


  • 부만

4.8. 5 24




4.8.1.


바 <-> Objective - C?



 -> 

	- 바를 배  .

	-  Web View를 .

C부를 .

 -> Opensource 뒤 

를 보면 는데  

 ->   . 를 만들.

 

Sort .

	- Bubble Sort
	- Quick Sort를 배 .  
		->  .
#include<algorithm.h>

quicksort( );



<html>
<body>

<script type="text/javascript">
	document.write("<p>My first paragraph</p>");
</script>
</body>
</html>

4.8.2.


4.9. 5 31


#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void main() {
	int i,j,Input;
	int temp;
	int count = 0;
	int a[10] = {0,};
	srand(time(NULL));
	printf("\n");
	
	/*
	for(i=0;i<10;i++) { //  10 
		a[i] = rand()%10+1;
		printf("%3d", a[i]);
	}
	*/
	do{
		temp = rand()%10+1;
		for(i = 0;i<10;i++){
			if(a[i] == temp){
				temp = rand()%10+1;
				i = -1;
			}
		}

		a[count++] = temp;

	}while(count != 10);
	for(i = 0;i<10;i++)
		printf("%d ",a[i]);


	
	puts("\n---------------------------------");


	/*
	for(i=0;i<10;i++)
	{
		for(j=0;j<9;j++)
		{
			if(a[j]>a[j+1])
			{
				temp = a[j];
				a[j] = a[j+1];
				a[j+1] = temp;
			}
		}
	}
	*/
	/*
	for(i=0;i<10;i++)
	{
		for(j=i+1;j<10;j++)
		{
			if(a[i]>a[j])
			{
				temp = a[i];
				a[i] = a[j];
				a[j] = temp;
			}
		}
	} 
	*/

	for(i=0;i<10;i++) { //  
		printf("%3d", a[i]);
	}
	puts("");
	
}
  • : APM , (블, ) 5리 배 를 만들 .


#include<stdio.h>

int factorial(int n){
	if(n == 1) return 1;
	return n * factorial(n-1);
}

int summary(int n){
	if(n == 1) return 1;
	return n + summary(n-1);
}


int main(){
	
	int i,j,sum = 0, fact =1;
	int input = 5;

	for(i = 1; i <= input;i++){
		sum += i;
		fact *= i;
	}

	printf("sum : %d, fact : %d\n",sum,fact);

	sum = 0 ; fact =1;

	fact = factorial(input);
	sum = summary(input);

	printf("sum : %d, fact : %d\n",sum,fact);

	

	return 0;
}
  • : .

4.10. 6 1


  • Part


<html>
<head>
<script language = "javascript">

left = 10;
imagename = 1;

function key(){
	var image=document.getElementById("demo");
	image.style.position="absolute";

	if(imagename == 4){
		imagename = 1;
	}	
	alert(left);
	left += 1;
	
	image.src = imagename + '.jpg';
	imagename = imagename + 1;
	image.style.left = left;
	//image.style.left=(left+1)+'px';
	//var l=document.getElementById("demo").style.left += 1;
	
}
	
</script>

</head>

<body onKeyDown='key();'>

<img src = "1.jpg" id="demo" top = 10 left = 10>


</body>
</html>

4.11. 6 7

4.11.1.

  • => . .
  • APM 료 => 블. . APM_SETUP htdocs index.html .

4.11.2.


  • prime .
    //
    public class MyTest {
    
    	/**
    	 * @param args
    	 */
    	public static void main(String[] args) {
    		///prime 는 1    . 
    		int count = 0;
    		boolean flag = false;
    		
    		for(int i = 2; i< 1000; i++){
    			
    			flag = true;
    			for(int j = 2; j<i; j++){
    				if( (i % j) == 0) flag = false;
    			}
    			
    			if(flag == true){
    				System.out.println(i + "is prime Number!");
    				count++;
    			}
    			
    		}
    		System.out.println("Count : " + count);
    		
    	}
    
    }
    

4.11.3.


5. 6 13

5.1.

5.2.

  • 를 만들 면 뭐부 ? HTML부 -> .
  • DIV x,y .


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:47
Processing time 0.1881 sec