- English
- فارسی
C/C++ Programming Class Examples
C/C++ Programming Class Examples
- 01- 1386/11/08 - salam programs
- 02- 1386/11/10 - int, float vars, cin
- 03- 1386/11/13 - float constants, legal/illegal var names, if-else
- 04- 1386/11/15 - if-else nardebaani
-
05- 1386/11/24 - casting, a=b=c, conditional expressions && || !
- beyne3vapanj.cpp
- beyne3vapanj2.cpp
- beyne3vapanj3.cpp
- 07- 1386/11/27 - loop
-
08- 1386/11/29 - quiz, while, miyangin
- swap.cpp
- miyangin1.cpp
- miyangin2.cpp
- miyangin3.cpp
- 09- 1386/12/01 - adad avval
- 10- 1386/12/04 - do-while, more while examples (mabnaa8->10, adad kamel)
- 11- 1386/12/15 - while, polynomial
- 12- 1386/12/20 - for loop
- 13- 1386/12/22 - arrays
-
14- 1386/12/22 - (extra session) address, binary numbers
- addr_amp_star.cpp
- twosComp.ppt (pdf version here: twosComp.pdf )
- varMem.ppt (pdf version here: varMem.pdf)
-
15- 1386/12/22 - (extra session) binary, two's complement, signed/unsigned int, long, char
- signedUnsignedASCII.cpp
- varMem.ppt (pdf version here: varMem.pdf)
- twosComp.ppt (pdf version here: twosComp.pdf)
-
16- 1387/01/17 - loops, arrays
- puzzle.doc (soorat mas'ale)
- puzzle.cpp
- puzzle2.cpp
- gandom.ppt(power point slides)
-
17- 1387/01/19 - array addresses
- pointer1.cpp
- pointer2.cpp
- 2dArrayAddr.ppt (and the pdf version: 2dArrayAddr.pdf)
- 18 - 1387/01/21 - bitwise operators, <<. >>. #define
- 19 - 1387/01/31 - struct, function
- 20 - 1387/02/02 - bmp hw, function
-
21 - 1387/02/04 - function, struct =, array as param to func
- 3D image 1 (right:blue, left:red)
- 3D image 2 (right:red, left:blue)
- ashSholghalamkaar.cpp (ferestaadane do khorooji az taabe, meghdar-dehi avvaliye array)
- structError.cpp baraaye inke A=B raa anjaam dahim: structError_loosBaazi.cpp
- funcArray1.cpp
- funcArray2.cpp
-
22 - 1387/02/07 - func, array param, global/local, const, recursive func
- gandomFuncGlobalVars.cpp // global variables
- gandom2.cpp // arrays-->function parameters, const
- bazgashti.ppt
- factorial_simp_recursive.cpp
- 23 - 1387/02/09 - recursive func, struct as func param, string (char[])
- 24 - 1387/02/11 - strcat, new, delete, malloc, free
- 25 - 1387/02/14 - strcat, strcpy, strncpy, malloc, free, double **
- 26 - 1387/02/16 - strstr, new, delete
- 27 - 1387/02/18 - new (typedef), myStrStr, sscanf, sprintf, itoa, etc.
-
28 - 1387/02/21 - qsort, linked lists
- qsort.cpp
- linkedLists.ppt, pdf version: linkedLists.pdf
- llist.cpp
-
29 - 1387/02/23 - linked lists
- linkedLists2.ppt and the pdf version: linkedLists2.pdf
- linkedList1.cpp
- linkedListPrint.cpp
- pakKonAkhari__ghalat.cpp
- 30 - 1387/02/23 - recorded outside class - C file I/O
-
31 - 1387/02/25 - object-oriented programming
-
32 - 1387/02/28 - class Taarikh
- tarikhStruct.cpp
- tarikhClass1.cpp
- tarikhClass2.cpp
- tarikh.h , tarikh.cpp , tarikhMain1.cpp
- tarikhMain2.cpp
-
33 - 1387/02/30 - class design
- classDesign.ppt , classDesign.pdf
-
34 - 1387/03/01 - class Mokhtalet
- see examples for lecture 35
-
35 - 1387/03/04 - class Mokhtalet, operator+=, default parameter values, ref param calling, inheritance
- Operator overloading: Mokhtalet.cpp , Mokhtalet.h , MokhtaletMain.cpp
-
Default parameter values:
-
void alaki(int a, int b=4, int c=0);
// obj.alaki(3, 6, 5); === a=3,b=6,c=5
// obj.alaki(3,2); === a=3,b=2,c=0
// obj.alaki(4); === a=4, b=4, c=0
// obj.alaki(); ERROR! -
Mokhtalet();
Mokhtalet(double initR=0, double initI=0);
// compile error: ebhaam beyne do constructor-e baalaa.
// baayad constructor-e dovvom masalan be soorate zir
// tarif shavad ke had-de-aghal yek parametr dashte
// bashad:
Mokhtalet(double initR, double initI=0);
-
void alaki(int a, int b=4, int c=0);
-
Call by reference:
-
void swap (int &a, int &b)
{
int temp = a;
a = b;
b = temp;
} -
void main ()
{
int x=3, y=100;
swap (x, y);
// now x=100, y=3
}
-
void swap (int &a, int &b)
-
36 - 1387/03/06 - inheritance, virtual function table, STL
- Jiang Hu's powerpoint slides
- 38 - 1387/03/20 - STL (list, vector, map, set), string