컴퓨터 프로그래밍 기초 - 13th : 마지막 수업 -

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Sort the given string, without using string handling functions.
Pointers Discussion 5 Section Housekeeping HW 1 Issues Array Issues Exam 1 Questions? Submitting on Time!
Nested Loops. Problem Print The only printfs you can use are: –printf(“*”); –printf(“\n”); *****
1 CSE1301 Computer Programming Lecture 16 Pointers.
Tutorial #7 Summer sizeof int main() { char x; sizeof(x); sizeof(int); }
Multidimensional Arrays. Example Write a program to keep track of all warmup scores for all students. Need a list of a list of scores Student – score.
Guidelines for working with Microsoft Visual Studio.Net.
Guidelines for working with Microsoft Visual Studio 6.
Pointers Example Use int main() { int *x; int y; int z; y = 10; x = &y; y = 11; *x = 12; z = 15; x = &z; *x = 5; z = 8; printf(“%d %d %d\n”, *x, y, z);
Introduction to C Programming CE Lecture 9 Data Structures Arrays.
1 CSE1301 Computer Programming Lecture 16 Pointers.
1 Agenda - Loops while for for & while Nested Loops do-while Misc. & Questions.
Pointers CSE 2451 Rong Shi.
The char Data Type A char is a one byte integer type typically used for storing characters. Example: char oneLetter = ’D’; We enclose the character in.
CS1010E Programming Methodology Tutorial 3 Control Structures and Data Files C14,A15,D11,C08,C11,A02.
Computer Programming for Engineers. Outline Tic-Tac-Toe (O-X Game) Drawing 3x3 grid Receiving the inputs Checking for a winner Taking turns between.
Chapter 8: Arrays Introduction to arrays Declaring arrays Initializing arrays Examples using arrays Relationship with pointers Array passing to a function.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee C Language Part 3.
Struct 1. Definition: Using struct to define a storage containing different types. For example it can contain int, char, float and array at the same time.
One-dimensional arrays and strings: Chapter 6, Slide 1 The concept of array - an extension of the basic model of memory:
Computer programming Outline Arrays [chap 7 – Kochan] –The concept of array –Defining arrays –Initializing arrays –Character.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Pointers Value, Address, and Pointer. Values and Addresses int x, y, z; y x z values of x,
Pointers PART - 2. Pointers Pointers are variables that contain memory addresses as their values. A variable name directly references a value. A pointer.
C A RRAY Continue one dimensional array 1. Assume we have define this array: int hourlyTemp[ 24 ]; And we need to insert this array as parameter into.
Review (before the 1 st test): while (conditions) { statements; } while loop: if/else if/else statements: if (conditions) { statements; } else if (different.
2-D Arrays Declaration & Initialization. Declaration You can think of 2D arrays as a matrix rows and columns: – a 4x3 matrix –
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Welcome to CISC220 Data Structures in C++ sakai.udel.edu Office Hours: Tues 3PM - 4PM / Thurs 1PM - 2PM TA: David.
Arrays and Matrices. One-Dimensional Arrays An array is an indexed data structure All variables stored in an array are of the same data type An element.
Lecture 20-something CIS 208 Wednesday, April 27 th, 2005.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Functions and Pointers Dr. Sajib Datta Oct 6, 2014.
Array Sort. Sort Pass 1 Sort Pass 2 Sort Pass 3.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
Dr. Sajib Datta Sep 10,  #include  void main()  {  int a = 25;  int b = 0;  int c = -35;  if( a || b ) ◦ printf("Test1\n");  else.
Pointers (Revision). 2 Overview Revision of Pointers Pointers and structs Basic Pointer Arithmetic Pointers and Arrays.
Arrays Name, Index, Address. Arrays – Declaration and Initialization int x; y[0] y[1] y[2]
Dynamic memory allocation and Intraprogram Communication.
CISC220 Spring 2010 James Atlas Lecture 04: Pointers, Functions, Memory Management, ADTs, Classes, Hardware, Software, Graphics, Networking, AI, Databases,
C Programming Lecture 8 Call by Reference Scope. Call-by-Reference b For a C function to “effect” (read as “imitate”) call-by- reference: Pointers must.
Data Structures 1st Week
CSE 220 – C Programming Pointers.
Functions and Pointers
Linked List.
Queue data structure.
CSI-121 Structured Programming Language Lecture 16 Pointers
מצביעים והקצאה דינאמית
Dynamic memory allocation and Intraprogram Communication
Functions and Pointers
Dynamic memory allocation and Intraprogram Communication
Programming in C Part 2.
Pointers.
Lecture 18: The Elegant, Abstract World of Computing
הרצאה 6: כתובות ומצביעים הקצאה דינמית מחרוזות
Pointers  Week 10.
מצביעים וכתובות מבוא כללי למדעי המחשב
BOOM! count is [ ], should be
Introduction to Problem Solving and Programming
CSC215 Homework Homework 03 Due date: Oct 07, 2016.
Your questions from last session
CS150 Introduction to Computer Science 1
Week 6 CPS125.
CS150 Introduction to Computer Science 1
Character Arrays char string1[] = “first”;
Iteration Statement for
Enumerating all Permutations
Control Structure គោលបំណងនៃមេរៀន អ្វីជា Control structure ?
Presentation transcript:

컴퓨터 프로그래밍 기초 - 13th : 마지막 수업 - 김선균 (kyun@kangwon.ac.kr) 2017. 06. 21

< 목 차 >

11번 #include<stdio.h> #include<ctype.h> int count_word(const char *s);   int main(void) { printf("%d\n", count_word("the c book is very easy!")); return 0; } int count_word(const char *s) { int i, wc = 0, waiting = 1; for (i = 0; s[i] != NULL; ++i) { if (isalpha(s[i]) ) { if (waiting ) { wc++; waiting = 0; else { waiting = 1; return wc ;

13번 #include<stdio.h> #define SIZE 10 int main(void) { int list[SIZE] = {3, 2, 9. 7, 1, 4, 8, 0, 6, 5}; int i, j, temp, least; for(i = 0; i < SIZE - 1; i++) least = i; for(j = i + 1; j < SIZE; j++) least = j; } temp = list[i]; list[i] = list[least]; list[least] = temp; for(i = 0; i < SIZE; i++) printf("%d ", list[i]); printf("\n"); return 0;

14번 void swap(int *p, int *q) { int temp; temp = *p; *p = *q; *q = temp; }

4. Q&A