Daprogramebis safuZvlebi leqcia #3 2009-2010 sasw.w. I semestri Tsu asoc. prof. naTela arCvaZe Tsu asoc. prof. naTela arCvaZe Tsu, zusti da sabunebismetyvelo.

Презентация:



Advertisements
Похожие презентации
Daprogramebis safuZvlebi leqcia # sasw.w. I semestri Tsu asoc. prof. naTela arCvaZe Tsu asoc. prof. naTela arCvaZe Tsu, zusti da sabunebismetyvelo.
Advertisements

Daprogramebis safuZvlebi leqcia # sasw.w. I semestri Tsu asoc. prof. naTela arCvaZe Tsu asoc. prof. naTela arCvaZe Tsu, zusti da sabunebismetyvelo.
Object-Oriented Programming Ramzi Saifan Program Control Slides adapted from Steven Roehrig.
Virtual memory Linux. Ներածություն Kernel and user space work with virtual addresses (also called linear addresses) that are mapped to physical addresses.
Java Java java ISS, Wuhan University Nov., Java Java java Java Java Java ……
1. a=? b=? c=? {int a, b, c; a=(b=2+3)/2 - 4+(c=5%2); printf("%d %d %d \n", a, b, c); }
В. М. Гуровиц, while условие : # пока выполняется условие оператор 1 # повторять эти оператор 2 # операторы … оператор 3 # после завершения.
1. a=? b=? c=? {int a, b, c; a=(b=2+3)/2 - 4+(c=5%2); printf("%d %d %d \n", a, b, c); }
Daprogramebis safuZvlebi leqcia # sasw.w. I semestri Tsu asoc.prof. naTela arCvaZe Tsu asoc.prof. naTela arCvaZe Tsu, zusti da sabunebismetyvelo.
Лекция 2Лекция 2Структура программы Директивы препроцессора main () { Описания переменных Операторы }
Object Oriented Programming Ashraf Zia Lecturer Abdul Wali Khan University, Mardan. Lecture - 2.
Meet my Family This is my family. Ee He and She in our family We cannot live without Ee He and She in our family We cannot live without Ee He is my father.
ЛЕКЦИЯ 4 ОПЕРАТОРЫ.
Conditional Statements. Program control statements modify the order of statement execution. Statements in a C program normally executes from top to bottom,
Multiples Michael Marchenko. Definition In mathematics, a multiple is the product of any quantity and an integer. in other words, for the quantities a.
1/27 Chapter 9: Template Functions And Template Classes.
Data Types in C. A Data Type A data type is –A set of values AND –A set of operations on those values A data type is used to –Identify the type of a variable.
Loops Objectives Students will: 1. Explain what a loop is and describe the three main types of loops used in programming. 1. Дать понятие циклам. И объяснить.
Java. Fundamentals. LoopsЦиклы. Циклы С предусловием Циклы С постусловием Со счетчиком.
Baltic Talks 2004 Liaison Officer Senior Lieutenant Jukka I. Mattila Estonia Conscription % perform the national military service Reserves are formed.
Транксрипт:

daprogramebis safuZvlebi leqcia # sasw.w. I semestri Tsu asoc. prof. naTela arCvaZe Tsu asoc. prof. naTela arCvaZe Tsu, zusti da sabunebismetyvelo mecnierebaTa fakulteti, kompiuterul mecnierebaTa mimarTuleba

wina leqciaze ZiriTadi ganacxadebi da gamosaxulebebi int cvladi; /* komentari */ float cvladi; /* komentari */ char cvladi; /* komentari */ miniWebis Setyobineba beWdvis Setyobineba

Tema: marTvis Setyobinebebi ganStoebadi: pirobiTi, amorCevadi if Setyobineba if-else Setyobineba ganmeorebiTi, ciklis (looping): while Setyobineba break Setyobineba continue Setyobineba

if (piroba) Setyobineba; Tu studentis Sefaseba 51-ze metia an toli davbeWdoT sagani Cabarebulia. if (grade >= 51) printf("Passed course\n "); int grade; grade=…

, >=, ==, != && (and) ||(or) !=(no) grade>=51 daibeWdos sagani Cabarebulia diax ara

if-else Setyobineba if ( piroba ) Setyobineba1; else Setyobineba2; Tu Sefaseba 51-ze metia an toli davbeWdoT Tqven CaabareT sagani winaaRmdeg SemTxvevaSi davbeWdoT Tqven dagakldaT 51- grade qula

if (grade >= 51) printf("You passed course \n "); else printf("You need %d more points\n", 51- grade); grade>=51 daibeWdos Tqven CaabareT sagani diaxara daibeWdos Tqven dagakldaT 51-grade qula

#programis fragmentiSedegi 1 if(5>3)printf("yes"); yes 2 if(3>5) printf("no"); 3 int x=5;if(x>0) printf("%d is positive\n,x); 5 is positive 4 int y=-4; if(y<0) printf("%d is negative\n,y); -4 is negative 5 if(1)printf("yes");else printf("no"); yes 6 if(0)printf("yes");else printf("no"); no 7 int x=8; if(x>0) printf("yes"); else printf("no"); yes 8 int x=-8; if(x>0) printf("yes"); else printf("no"); no 9 int z=7; if(z>0)printf("%d is >0\n",z); else printf("%d is <0\n",z); 7 is >0

Cadgmuli if Setyobineba if (number > 0) /* pirveli if Setyobineba */ if ( number % 2 == 0) /* meore if Setyobineba */ printf("Number positive and even\n"); else printf("Number positive and odd\n");

#programis fragmentiSedegi 1 if(5>=0) if(3>2)printf("yes"); else printf("no"); yes 2 if(5>=0) if(2>3)printf("yes"); else printf("no"); no 3 if(5 3)printf("yes"); else printf("no"); 4 if(5 3)printf("yes"); else printf("no"); else printf("this"); this

#programis fragmentiSedegi 1 if(5>3 && 1)printf("yes\n"); else printf("no\n"); yes 2 int x=3; if(x==3 && 5<2)printf("yes\n"); else printf("no\n"); no 3 int y=5; if(0 && y>=0)printf("yes\n"); else printf("no\n"); no 4 if(2 3)printf("yes\n"); else printf("no\n"); yes 5 int k=0; if(5>2 || k)printf("yes\n"); else printf("no\n"); yes

pirobiTi operacia (piroba) ? gamosax 1: gamosax 2; max = (x > y) ? x : y ; max = x > y ? x : y ; if(x>y) max=x;else max=y; Abs = (x >= 0 )? x : -x ; Abs = x >= 0 ? x : -x ; if(x>=0)Abs=x;else Abs=-x;

rogor ar unda gamoviyenoT strcmp /* SevamowmoT string1 == string2 */ if (strcmp(string1, string2) == 0) printf("Strings equal\n"); else printf("Strings not equal\n"); ar SeiZleba ase Semokleba: if (strcmp(string1, string2)) printf("......");

ganmeorebis (looping) Setyobineba igive cikli while ( piroba ) Setyobineba ; piroba Sesasrulebeli Setyobinebebi diax ara

ipoveT 7 –idan 103 –mde 5-is jeradi ricxvebis jamis meoTxedi. int main() { int a=7; /* mTeli ricxvi, dawyebuli 7-dan */ int s=0; /* 5-is jeradi ricxvebis jami */ /* ricxvebisTvis 7-dan 103-is CaTvliT bijiT 1 */ while (a++<=108) //while(a<=108){ if(a%5==0) s+=a; // if(a%5==0) s=s+a; a=a++1;} /* Tu ricxvi 5-is jeradia davamatoT igi jams da TviTon ricxvi a gavzardo 1-iT */ printf("s=%0.2f\n", s/4.0); / * jamis meoTxedi */ system("pause"); return 0; }

break Setyobineba while ( piroba1 ) { operatori1 ; if ( piroba2 ) break; }... gagrZeleba...

continue Setyobineba while (1) Setyobineba ; while ( piroba1 ) { operatori1 ; if ( piroba2 ) continue; operatori2; }... gagrZeleba...

failSi Cawera #include int main() { char a, b, c; freopen( "data.txt", "r", stdin); scanf("%c%c%c", &a, &b, &c); freopen( "output.txt", "w", stdout); printf("%c %c %c", c, b, a); return 0;}

kursis kategoriebi: kompiuteruli mecnierebebi kursi: daprogramebis safuZvlebi Semodgoma :