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.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.1348 sec