080629_CFP °ø°³¿ë.hwp

Similar documents
C프로-3장c03逞풚

C++ Programming

C++ Programming

Microsoft PowerPoint - Chapter 6.ppt

윤성우의 열혈 TCP/IP 소켓 프로그래밍

1. 객체의생성과대입 int 형변수 : 선언과동시에초기화하는방법 (C++) int a = 3; int a(3); // 기본타입역시클래스와같이처리가능 객체의생성 ( 복습 ) class CPoint private : int x, y; public : CPoint(int a

Microsoft PowerPoint - C++ 5 .pptx

쉽게 풀어쓴 C 프로그래밍

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - additional06.ppt [호환 모드]

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout << " 양수입력 : "; cin >> *p; if (*p <= 0) cout << " 양수를입력해야합니다 " << endl; return; 동적할

쉽게 풀어쓴 C 프로그래밍

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

설계란 무엇인가?

쉽게 풀어쓴 C 프로그래밍

Microsoft PowerPoint - additional01.ppt [호환 모드]

슬라이드 1

class Sale void makelineitem(productspecification* spec, int qty) SalesLineItem* sl = new SalesLineItem(spec, qty); ; 2. 아래의액티비티다이어그램을보고 Java 또는 C ++,

Microsoft PowerPoint - additional08.ppt [호환 모드]

K&R2 Reference Manual 번역본

Microsoft PowerPoint - 8ÀÏ°_Æ÷ÀÎÅÍ.ppt

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070>

PowerPoint Template

설계란 무엇인가?

슬라이드 1

C++ Programming

Microsoft PowerPoint - [2009] 02.pptx

The C++ Programming Language 4 장타입과선언 4.11 연습문제 Hello,world! 프로그램을실행시킨다. 프로그램이컴파일되지않으면 B3.1 을참고하자. #include<iostream> //#include 문, 헤더파일, 전처리지시

(Microsoft PowerPoint - 07\300\345.ppt [\310\243\310\257 \270\360\265\345])

1. 기본형의형변환복습 C/C++ 형변환의종류 자동형변환 ( 묵시적형변환 ) 강제형변환 ( 명시적형변환 ) 기본형의자동형변환의예 1. 배열 to 포인터변환 배열명은해당배열의첫번째원소의 주소로변환됨 int ary[10]; int *pary = ary; 2. 함수 to 포

chap10.PDF

PowerPoint 프레젠테이션

JAVA 프로그래밍실습 실습 1) 실습목표 - 메소드개념이해하기 - 매개변수이해하기 - 새메소드만들기 - Math 클래스의기존메소드이용하기 ( ) 문제 - 직사각형모양의땅이있다. 이땅의둘레, 면적과대각

02 C h a p t e r Java

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

PowerPoint 프레젠테이션

중간고사

(Microsoft PowerPoint - 11\300\345.ppt [\310\243\310\257 \270\360\265\345])

Microsoft PowerPoint - additional07.ppt [호환 모드]

윤성우의 열혈 TCP/IP 소켓 프로그래밍

PowerPoint 프레젠테이션

PowerPoint Template

PowerPoint Template

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

쉽게 풀어쓴 C 프로그래밍

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

PowerPoint Presentation

PowerPoint 프레젠테이션

Microsoft PowerPoint - Chapter 1-rev

금오공대 컴퓨터공학전공 강의자료

untitled

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

(Microsoft Word - \301\337\260\243\260\355\273\347.docx)

untitled

PowerPoint Presentation

Chapter 4. LISTS

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - 05장(함수) [호환 모드]

설계란 무엇인가?

Microsoft PowerPoint - additional-11_13l.ppt [호환 모드]

Microsoft PowerPoint - chap05-제어문.pptx

C 언어 프로그래밊 과제 풀이

untitled

The C++ Programming Language 5 장포인터, 배열, 구조체 5.9 연습문제 다음의선언문을순서대로작성해보자. 문자에대한포인터, 10개정수의배열, 10개정수의배열의참조자, 문자열의배열에대한포인터, 문자에대한포인터에대한포인터, 상수정수, 상수

Microsoft PowerPoint - 9ÀÏ°_ÂüÁ¶ÀÚ.ppt

Microsoft PowerPoint - chap06-2pointer.ppt

03장.스택.key

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

설계란 무엇인가?

8. 클래스 D는클래스 A, 클래스 B, 클래스 C로부터상속받아맊들고싶다. 아래빈칸을채우시오. ( 대소문자주의하시오 ) class D { ; Student s; 11. 다음프로그램의실행결과는? 9. 다음프로그램의실행결과는? class A{ A(){cout << " 생성

<4D F736F F F696E74202D2036C0CFC2B05FB0B4C3BCC1F6C7E2C7C1B7CEB1D7B7A1B9D62E707074>

PowerPoint Presentation

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

C++ Programming

Microsoft PowerPoint - chap11-포인터의활용.pptx

Microsoft Word - java19-1-midterm-answer.doc

슬라이드 1

윤성우의 열혈 TCP/IP 소켓 프로그래밍

윤성우의 열혈 TCP/IP 소켓 프로그래밍

Programming hwp

Java ...

Design Issues

3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터

C++ Programming

Blog

Microsoft PowerPoint - CSharp-10-예외처리

윤성우의 열혈 TCP/IP 소켓 프로그래밍

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

설계란 무엇인가?

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2

q 이장에서다룰내용 1 객체지향프로그래밍의이해 2 객체지향언어 : 자바 2

쉽게 풀어쓴 C 프로그래밊

설계란 무엇인가?

Lab 3. 실습문제 (Single linked list)_해답.hwp

기초컴퓨터프로그래밍

5장.key

OCW_C언어 기초

Microsoft PowerPoint - Chapter 10.ppt

PowerPoint 프레젠테이션

Transcription:

int deleteq(int *front, rear) int item; if ( ( 가 ) ) retuen queue_empty; ( ( 나 ) ) ; return queue[*front];

주어진문제의해에접근한결과, 즉근사해를출력하거나혹은일정확률이상의정확한해를구할수있는알고리즘으로, 이알고리즘은주어진문제에대한근사해로만족할수있거나, 간혹틀린해를출력하는경우를허용할수있는경우활용할수있다.

( 가 ) 클래스후보를찾아내고개념적인객체모형을작성한다. ( 나 ) 클래스의속성, 오퍼레이션및클래스사이의관계를찾아객체모형을완성한다. ( 다 ) 요구사항을사용사례로정리하고사용사례다이어그램을작성한다. ( 라 ) 사용사례를기초하여순서다이어그램을작성한다. ( 마 ) 상태다이어그램이나액티비티다이어그램등다른다이어그램을추가하여 UML 모형을완성한다. 인터넷상에서 HTTP를통해사용자컴퓨터나장치에애플리케이션을수행해주는미들웨어 ( 소프트웨어엔진 ) 로, Web 서버의기능들을구조적으로분리하여처리하고자하는목적으로제시된것이며, 크게 Web 서버의기능과컨테이너의기능으로구성된다.

이것은웹사이트에접속한사용자가공격의대상이되는기법으로, 사용자의입력값에악의적인 Javascript code를삽입하여웹페이지를로드함으로현재페이지를열람하는사용자에게스크립트를실행시키도록하는것이다. 그러므로사용자의입력을받는모든사이트에서이것의공격이일어날가능성이있습니다. void tripler (int &n) n = 3 * n; int arr[3] = 4,5,6, num =2; int myfunc(int n) int num=0; while (n > 0) num = num * n; n--; return num; cout << myfunc(3); // 함수호출

class Person int age; char gender; float salary; public: void setage(int); void setgender(char); void setsalary(float); int getage(); char getgender(); float getsalary(); ; Person employee[10]; 해당블록에서만유효하고, 자동적으로초기화하지않기때문에반드시초기화해주어야하며, 스택에저장된다. 지역변수가여기에속한다.

( 가 ) 승진 (promotion) 에의한형변환 ( 나 ) 정확하게일치하는경우 (exact match) ( 다 ) 표준형변환 (standard conversions) ( 라 ) 사용자에의한형변환 (user-defined conversions) 가상함수를선언하면동적바인딩을하게되고동적 바인딩을하게되면객체에의해서호출될멤버함수가 결정되므로멤버함수를호출할때포인터변수의자료 형에의존하지않게된다. 결국프로그래머가처리할 내용은멤버함수를선언할때 ( ( 가 ) )( 을 ) 를추가 하는것뿐이다.

( 가 ) ( 나 ) int abs(int num) double abs(double num) if(num < 0) if(num < 0) num = -num; num = -num; return num; return num; ( 다 ) [ a ] < [ b ] T> T abs(t num) if(num < 0) num = -num; return num; #include <iostream> ostream &mysetup(ostream &stream) stream.width(10); stream.precision(4); stream.fill('*'); return stream; main() cout<<mysetup<<123.456789; return 0; void func(int a) [ A ](char *, int) try if(a == 0) [ A ] " 변수의값이 0 이다. ; else [ A ] a; catch(int ex) cout<<" 숫자 << ex << " 로인한예외발생 <<endl;

1. 열거형변수를사용하기로한다. 2. 신호등조작은빨간불 ( 적신호 ) 부터시작해서, 파란불 ( 청신호 ), 노란불 ( 황색신호 ) 의순으로점멸하는것으로한다. 3. 신호가바뀐회수를키보드로입력하면그값에따라어떤신호가들어와있는지를표시하기로한다. 신호가바뀐횟수는? 80 <== 키보드입력 blue Press any key to continue_ #include<iostream> using namespace std; [ (1) ] signal red, yellow, blue ; int main() int n; cout << " 신호가바뀐횟수는? " ; cin >> n; int ncur=n[ (2) ] ; [ (3) ](ncur) case red: cout << "red"; [ (4) ] ; case yellow: cout << "yellow"; [ (4) ] ; case blue: cout << "blue"; [ (4) ] ; cout <<endl; return 0;

1 break 2 cin 3 continue 4 cout 5 enum 6 if 7 in 8 n*3 9 n/3 10 n%3 11 out 12 switch 13 while

1) 현재학생들의성적을넣어주면그총합을구하는클래스가있다. 2) 아래와같은 < 실행결과 > 가나오도록평균을구하는기능을추가한다. 3) Student, Calculator의코드를고치지않고, 클래스를추가, 상속하여 2번의요구사항을만족하도록한다. 4) 학생들의성적데이터는모두 4개이고, 그값은각각아래와같다. 가 1번 : 80점나 2번 : 90점다 3번 : 100점라 4번 : 76점 < 기존의코드 > #include <iostream> using namespace std; class Student [ (5) ] : Student() number = 0; grade = 0; ; Student(int argnumber, int arggrade):number(argnumber), grade(arggrade); ~Student(); int GetNumber() return number; ; int GetGrade() return grade; ; [ (6) ] : int number; int grade; ;

class Calculator [ (5) ]: Calculator() numberofstudent = 0; ; void AddStudent(Student argstudent); int Sum(); [ (6) ]: Student student[50]; [ (7) ]: int numberofstudent; ; void [ (8) ](Student argstudent) student[numberofstudent++] = argstudent; ; int [ (9) ]() int sum = 0; for (int i = 0; i < [ (10) ] ; i++) sum += [ (11) ] ; return sum; ; < 추가한코드 > class CalculatorEx : [ (12) ] public: CalculatorEx(); float Average() float average = 0.0; average = Sum() / [ (13) ] ; return average; ; ;

void main() Student student1(1, 80); Student student2(2, 90); Student student3(3, 100); Student student4(4, 76); [ (14) ] cal; cal.addstudent(student1); cal.addstudent(student2); cal.addstudent(student3); cal.addstudent(student4); cout << " 학생들의성적합계 : " << cal.sum() << endl; cout << " 학생들의성적합계 : " << cal.average() << endl; 1 AddStudent 2 argstudent 3 Calculator 4 CalculatorEx 5 Calculator::AddStudent 6 Calculator::Sum 7 numberofstudent 8 private 9 protected 10 public 11 public Calculator 12 public Student 13 Student[i] 14 Student[i].GetGrade() 15 Sum() 16 Sum() / (float) argstudent 17 Sum() /(float)numberofstudent 18 Sum() / numberofstudent

1. 동적으로메모리를이용한다. 2. < 실행예 > 는사용자가 5개의정수를입력했을경우이다. 몇개의숫자를입력할까요? 5 1번째숫자입력 : 5 2번째숫자입력 : 8 3번째숫자입력 : 35 4번째숫자입력 : 22 5번째숫자입력 : 10 가장큰수 : 35, 3번째 Press any key to continue 01: #include<iostream> 02: using namespace std; 03: class FindMax 04: 05: private: 06: int max; 07: int max_loc; 08: int size; 09: int *num; 10: public: 11: FindMax(int); 12: ~FindMax(); 13: void readnum(); 14: void searchmax(); 15: void prn(); 16: ;

17: FindMax::FindMax(int n) 18: 19: max = 0; 20: max_loc = 1; 21: size = n; 22: num = int new[size]; 23: 24: FindMax::~FindMax() 25: 26: delete num[]; 27: 28: void FindMax::readNum() 29: 30: for(int i=0; i<size; i++) 31: 32: cout<< i+1 << " 번째숫자입력 : " ; 33: cin>>num[i]; 34: 35: 36: void FindMax::searchMax() 37: 38: max = num; 39: for(int i=1; i<size; i++) 40: 41: if(max < *(num+i)) 42: 43: max = *(num+i); 44: max_loc = i+1; 45: 46: 47: 48: void FindMax::prn() 49: 50: cout<<"\n 가장큰수 : " << max << ", " << max_loc << " 번째 "<<endl; 51: 51: void main() 52: 53: int n; 54: cout<< " 몇개의숫자를입력할까요? " ; 55: cin >> n; 56: FindMax my(n); 57: my.readnum(); 58: my.searchmax(); 59: my.prn(); 60:

4개의단어를입력하세요 ==> 1번째단어 : we 2번째단어 : enjoy 3번째단어 : cpp 4번째단어 : programming 결과출력 =====> #include <iostream> #include <string> using namespace std; #define MAX 4 class Work string words[max]; public: Work(); void func(); void print(); ; Work::Work() cout << "4개의단어를입력하세요 ==>" << endl; for(int i=0; i<max; i++) cout << i+1 << " 번째단어 : "; cin>>words[i];

void Work::func() string t; for(int n = (MAX-1); n>0; n--) for(int i=0; i<n; i++) if(words[i] < words[i+1]) t = words[i]; words[i] = words[i+1]; words[i+1] = t; void Work::print() cout << " \n결과출력 =====> \n"; for(int i=0 ; i<max ; i++) cout << words[i]<<"\n"; int main() Work my; my.func(); my.print();

#include<iostream> #include <cstring> #include <string> using namespace std; 01: int main() 02: 03: char str1[10]="we"; char *str2="enjoy"; char str3[100]; 04: string str4 = "we"; string str5 = "enjoy"; string str6; 05: strcpy(str3, "programming"); 06: cout << str3.at(3); 07: cout << strlen(str1); 08: str3 = str1+str2; 09: strcat(str3, str1); 10: str6 = "programming"; 11: cout << length(str4); 12: cout << str4.length(); 13: strcpy(str5, str4); 14: cout << str4.at(1); 15: cout << str5[4]; 16: str6 = str4 + str5 + str6;