반응형
<?php
  $user["name"]="홍길동";
  $user["age"]=28;
  $user["job"]="회사원";
  //루프를 돌면서 배열의 값을 출력한다.

  foreach($user as $value)
  {
  	print $value . "<br/>";
  }

  print "<br/>";
  //루프를 돌면서 배열의 키와 값을 출력한다.

  foreach($user as $key => $value)
  {
  	print $key . " ? " . $value . "<br/>";
  }
?>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

insert - delete  (0) 2019.08.26
Array2  (0) 2019.08.26
table  (0) 2019.08.26
케이스  (0) 2019.08.26
대소 비교  (0) 2019.08.26
반응형
<?php
   print "table 출력<br/><br/>";

   print"<table border=1>";

   print "<tr>";
   print "  <td>라인 수</td>";
   print "  <td>\$i의 값</td>";
   print "</tr>";

   $i=0;
   while($i < 10)
   {
   	print "<tr>";
	print "  <td>".($i+1)."라인</td>";
	print "  <td>".$i."</td>";
	print "</tr>";
	$i++; 
  }
print "</table>";

print "<br/>10 라인이 생성되었습니다.";
?>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

Array2  (0) 2019.08.26
Array  (0) 2019.08.26
케이스  (0) 2019.08.26
대소 비교  (0) 2019.08.26
단항 연산자  (0) 2019.08.25
반응형
<?php
$i=0;
switch($i)
{
	case 0:
		print "1는 0과 같다.";
		break;
	case 1:
		print "1는 1과 같다.";
		break;
	case 2:
		print "1는 2와 같다.";
		break;

	}
?>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

Array  (0) 2019.08.26
table  (0) 2019.08.26
대소 비교  (0) 2019.08.26
단항 연산자  (0) 2019.08.25
화면에 출력하기  (0) 2019.08.25
반응형
<?php
$a=3;
$b=7;
if($a > $b)
{
	print "a는 b보다 크다";
}

elseif($a < $b)
{
	print "a는 b보다 작다";
}
else
{
	print "a와 b는 같다";
}
?>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

table  (0) 2019.08.26
케이스  (0) 2019.08.26
단항 연산자  (0) 2019.08.25
화면에 출력하기  (0) 2019.08.25
BOX  (0) 2019.08.25
반응형
#include <stdio.h>
#include <stdlib.h>
#define MAX_VERTICES 8 // 노드 최고 개수 8 
#define FALSE 0
#define TRUE 1
typedef struct node *node_point; //선언자  
typedef struct node
{
	int vertex; // 번호 
	node_point link;
};
node_point graph[MAX_VERTICES];
short int visited[MAX_VERTICES]; // 방문기록-배열  
typedef struct queue *queue_point;
typedef struct queue
{
	int vertex;
	queue_point link;
};
node_point createnode(int data);
void bfs (int vertex); // BFS함수 선언 
void addq(queue_point *, queue_point *, int);
int deleteq (queue_point *front); 
int main()
{
	graph[0] = createnode(1);
	graph[0]->link = createnode(2);
	graph[1] = createnode(0);
	graph[1]->link = createnode(3);
	graph[1]->link->link = createnode(4);
	graph[2] = createnode(0);
	graph[2]->link = createnode(5);
	graph[2]->link->link = createnode(6);
	graph[3] = createnode(1);
	graph[3]->link = createnode(7);
	graph[4] = createnode(1);
	graph[4]->link = createnode(7);
	graph[5] = createnode(2);
	graph[5]->link = createnode(7);
	graph[6] = createnode(2);
	graph[6]->link = createnode(7);
	graph[7] = createnode(3);
	graph[7]->link = createnode(4);
	graph[7]->link->link = createnode(5);
	graph[7]->link->link->link = createnode(6);
	printf(" : "); // 정점의 운행 순서
	bfs(0); // 0번 호출
	printf(" \n"); // 끝
}

/* 노드 생성을 위한 함수  */
node_point createnode(int data)
{
	node_point ptr;
	ptr = (node_point)malloc(sizeof(struct node)); //메모리 확보 
	ptr->vertex = data;
	ptr->link = NULL;
	return ptr;
}

void bfs (int v)
{
	node_point w;
	queue_point front, rear;
	front = rear = NULL;
	printf("V%d-> ", v);
	visited[v] = TRUE;
	addq (&front, &rear, v);
	while (front)
	{
		v = deleteq (&front);
		for (w=graph[v]; w;w=w->link)
		if (!visited[w->vertex])
		{
			printf ("V%d-> ", w->vertex);
			addq (&front, &rear, w->vertex);
			visited[w->vertex] = TRUE;
		}	
	}
}
void addq (queue_point *front, queue_point *rear, int data)
{
	queue_point temp;
	temp = (queue_point)malloc(sizeof(struct queue));
	temp->vertex = data;
	temp->link = NULL;
	if (*front)
	(*rear)->link = temp;
	else
	*front = temp;
	*rear = temp;	
}
int deleteq (queue_point *front)
{
	queue_point temp;
	int data;
	temp = *front;
	data = temp->vertex;
	*front = temp->link;
	free(temp);
	return data;
}
/*
 : V0-> V1-> V2-> V3-> V4-> V5-> V6-> V7->

--------------------------------
Process exited after 0.01723 seconds with return value 0
계속하려면 아무 키나 누르십시오 . . .
*/	
반응형

'2019~2020 > 자료구조' 카테고리의 다른 글

버블정렬  (0) 2019.09.11
최댓값 찾기 알고리즘  (0) 2019.09.03
행렬을 이용한 BFS (c)  (0) 2019.08.20
연결 리스트 DFS (c)  (0) 2019.08.16
그래프의 탐색  (0) 2019.08.12
반응형
<?php
$a=5;
print $a++; //5가 출력, $a를 1증가
print $a; //6 출력

$a=5;
print ++$a; //1 증가된 값이 $a에 대입 6이 출력
print $a; //6 출력

$a=5;
print $a--; //5 출력, %a 1 감소
print $a; //4출력

$a=5;
print --$a; //1 감소된 값이 $a에 대입, 4출력
print $a; //4가 출력
?>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

케이스  (0) 2019.08.26
대소 비교  (0) 2019.08.26
화면에 출력하기  (0) 2019.08.25
BOX  (0) 2019.08.25
박스 모델  (0) 2019.08.25
반응형
<!doctype html>
<html lang="en">
 <head>
    <title>화면에 출력</title>
 </head>
 <body>
 <?php
 	echo("Hello<br>");
	echo("PHP의 세계에 오신 것을 환영합니다.<br>");
	print("우리 함께 PHP로 여행을 떠나요 *^^*");
   ?>
 </body>
</html>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

대소 비교  (0) 2019.08.26
단항 연산자  (0) 2019.08.25
BOX  (0) 2019.08.25
박스 모델  (0) 2019.08.25
웹 폰트 적용하기  (0) 2019.08.25
반응형
<!DOCTYPE html>
<html lang="ko">
<head>
	<meta charset="utf-8">
	<title>애완견 돌보기</title>
	<link href="layout.css" rel="stylesheet" type="text/css">	
</head>
<body>
	<header>
		<h1>애완견 종류</h1>
		<nav>
			<ul>
			  <li><a href="#">애완견 종류</a></li>
			  <li><a href="#">입양하기</a></li>
			  <li><a href="#">건강돌보기</a></li>
			  <li><a href="#">더불어살기</a></li>
			</ul>
		  </nav>
	</header>
	<section>
		<article id="pet1">  
		  <h3>활달한 강아지</h3>
		  <dl>
			<dt>요크셔 테리어 </dt>
			<dd>생기있고 활달한 성질을 가지고 있으며 자신보다 몸집이 큰 개나 집에 들어온 침입자를 겁내는 일이 없어 좋은 번견이고 우리나라 최고의의 가정견으로 자리 잡고 있다.</dd>
			<dt>말티즈 </dt>
			<dd>애정이 많고, 충실하며 활발한 성격을 소유하고있다. 이 종은 1급 가정견으로 요크셔테리어와 함께 우리나라 최고의 가정견으로 자리잡고 있다.</dd>
			<dt>포메 라이언</dt>
			<dd>활기차고 명랑한 개로 유명하고, 걷는 모습이 우아하다.충실하고 우호적인 성격이 가장 먼저 거론된다. </dd>
		   <dt>골든 리트리버</dt>
		   <dd>이 견종은 충성심이 강하고 성격이 활달하여 어린아이나 여성이 상대하기에 적합한 견종이다.참을성 또한 강하여 현재는실내에서도 많이 길러지고 있다.</dd>
		</dl>
		</article>
		<article id="pet2">
		  <h3>온순한강아지</h3>
		  <dl>
			<dt>쉬즈</dt>
			<dd> 얼굴에서 풍기는 모습처럼 온순, 쉽게 친숙해지고 우호적이며,어린아이나 여성들이 기르기에 적합한 견종이다.</dd> 
		   <dt>퍼그</dt>
		   <dd>매우 사려가 깊고 사랑스러운 견종이며 그다지 손질이 필요하지 않고 식사량에 비해 많은 운동량이 필요하지 않다.</dd>
		   <dt>래브라도 리트리버</dt>
		   <dd>침착하고 영리하여 어린이들을 안심하고 맡길 수 있다. 사람을 즐겁게 해주려는 성질이 있다 공을 가지고 노는 것을 가장  좋아한다. 현재 맹인 안내견과 마약견으로 사용중이다. 온순한 강아지를 좋아하는 분에게는 적합한 견종이다.</dd>
		  </dl>
		</article>
		<article id="pet3">
		   <h3>사납지만 복종적인 강아지</h3>
		   <dl>
			  <dt>미니어쳐핀셔</dt>
			  <dd>경계심이 강하고 영리하며 작은 몸집에 비해 매우 용감하다. 주인에게 매우 복종적이며 작은 몸집에 보디가드 역할을 충실히 수행한다.</dd>
			   <dt>푸들 </dt>
				<dd>사납진 않으나, 상당히 복종적이며, 지능지수가 애완견종 중 가장 뛰어나다.</dd>
				<dt>폭스테리어</dt>
				 <dd>가정에서 키우기에 적합한 품종이다.  보호본능이 강하고 정이 많다. 하지만 사냥을 하던 본능이 조금은 남아있어 사나운 면이 있다. 이종을 좋은 품종으로 기르기 위해서는 어릴 때부터 엄한 훈련이 필요하기도 하다.</dd>
		   </dl>
		 </article>
		<aside>
			<h3>건강한 강아지는</h3>
			<ul>
			  <li>코가 젖어있고 눈꼽이 없어야 합니다.</li>
			  <li>털에 윤기가 있는 것을 골라야 합니다.</li>
			  <li>입에서 고약한 냄새가 나면 병이 있다는 증거입니다.</li>
			  <li>가장 활발하게 움직이는 녀석을 고르는게 좋습니다.</li>
			  <li>강아지들 중에서 적당한 체구를 유지한 강아지가 좋습니다.</li>
			</ul>
		</aside>
	</section>
	<footer>
		<p>Copyright 2012 funnycom</p>
	</footer>
</body>
</html>

layout.css

body{
	font-family:"맑은 고딕", "고딕", "굴림";
    }
header{
	width: 80%;
	margin-right: auto;
	margin-left: auto;
	background-color: #069;
	padding: 10px;
	overflow: hidden;
      }

 header h1{
	width: 40%;
	float: left;
	color: #fff;
	}

header nav{
	width: 60%;
	float: right;
	}

nav ul{
	list-style-type: none;
	}

nav ul li{
	display: inline;
	float: left;
	margin: 15px;
	}

nav ul li a{
	color: white;
	text-decoration: none;
	}

p{
  font-size:15px;
  line-height: 20px;
  }

dt{
   font-weight: bold;
   color: purple;
   }

h1{
   font-size: 2em;
   }

section{
	width: 80%;
	margin-right: auto;
	margin-left: auto;
	border: 5px solid #333;
	padding: 5px;
	overflow: hidden;
	}

article h3{
	background-image:url(image/bg.png);
	background-repeat:no-repeat;
	background-position:left center;
	padding-left: 30px;
	}

aside{
	clear: both;
	height: auto;
	padding: 10px;
	}

footer{
	clear: both;
	width: 80%;
	margin-right: auto;
	margin-left: auto;
	margin-top: 0;
	padding:10px;
	background-color: #333;
	color:white;
	text-align:center;
}
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

단항 연산자  (0) 2019.08.25
화면에 출력하기  (0) 2019.08.25
박스 모델  (0) 2019.08.25
웹 폰트 적용하기  (0) 2019.08.25
웹 폰트 사용하기  (0) 2019.08.25
반응형
<!doctype html>
<html lang="ko">
 <head>
  <meta charset="UTF-8">
  <title>박스모델</title>
  <style>
  	div{
		width: 200px;
		height: 100px;
		display: inline-block;
		margin: 15px;
		border-width: 5px; /*테두리 굵기*/
		}
		.box1 {border-style: inset;
			   border-top-width: 1px; border-left-width: 1px; text-align: center;
			   border-top-color: red;
			   border-right-color: green; border-bottom-color: green;			   border-bottom-right-radius:50% 50%;
			   box-shadow:2px -2px 5px 0px black;} /*실선*/
		.box2 {border-style: dotted;box-shadow:2px -2px 5px 0px black;} /*점선*/
		.box3 {border-style: dashed;} /*선으로 된 점선*/
  </style>
 </head>
 <body>
	<div class="box1">으아악</div>
	<div class="box2"></div>
	<div class="box3"></div>
 </body>
</html>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

화면에 출력하기  (0) 2019.08.25
BOX  (0) 2019.08.25
웹 폰트 적용하기  (0) 2019.08.25
웹 폰트 사용하기  (0) 2019.08.25
Transform  (0) 2019.08.25
반응형
<!doctype html>
<html lang="ko">
 <head>
  <meta charset="UTF-8">
  <title>웹 폰트 사용하기</title>
<link href="https://fonts.googleapis.com/css?family=Nanum+Myeongjo&display=swap" rel="stylesheet">
 <style>
 
   @font-face{
   				font-family: 'Nanum Myeongjo', serif;
			 }
  .w-font{
  			font-family:'Nanum Myeongjo', serif;/*웹 폰트 지정*/
		 }
		 
		p{
			font-size: 30px; /*글자 크기*/
		 }

  	div{
		width:500px;
		height:300px;
		border-radius:10px;
	   }
	.grad{
			background: #ff00cc; /*css3 미지원 브라우저*/
			background: -webkit-linear-gradient(left top,#ff00cc,white);/*초기 모던 브라우저*/
			background: -moz-linear-gradient(right bottom, #ff00cc, white);/*초기 모던 브라우저*/
			background: -o-linear-gradient(right bottom, #ff00cc, white);/*초기 모던 브라우저*/
			background: linear-gradient(to right bottom, #ff00cc, white);/*최신 모던 브라우저*/
		 }
 </style>
 </head>
 <body>
  <div class="grad">
  <p>디폴트 폰트</p>
  <p class="w-font">적용 폰트</p>
 </body>
</html>
반응형

'2019~2020 > 웹 프로그래밍 (PHP)' 카테고리의 다른 글

BOX  (0) 2019.08.25
박스 모델  (0) 2019.08.25
웹 폰트 사용하기  (0) 2019.08.25
Transform  (0) 2019.08.25
내부 스타일시트  (0) 2019.08.25

+ Recent posts