280
কমউটর পপগম(ম পপগমম - মমএফ মরণ ১.০) তমমম শহ মরয়র মন

Computer programming

Embed Size (px)

Citation preview

  1. 1. ( - .)
  2. 2. : : : ??http://cpbook.subeen.com
  3. 3.
  4. 4. , , , , ! , , - , , ; , ! - , , , , , , ??http://cpbook.subeen.com
  5. 5. () , , ( )
  6. 6. - ? , , '' , , , , , , , , , , , , , , , , , , , http://cpbook.subeen.com [email protected] ??http://cpbook.subeen.com
  7. 7. , (Loop) (String) : : :
  8. 8. ,?,,, (0) (1) (user) , 010,1 , 0,1 ,, ADD(),MUL()0,1 , (Fortran),(Basic),(Pascal),(C),, ,(C++),(VisualBasic),(Java),(C#),(Perl),(PHP), (Python),(Ruby) , , , (logic), ??http://cpbook.subeen.com
  9. 9. , , , , , (, ) , ,(), , ,,, , , ,?, gcc Codeblocks(http://www.codeblocks.org/) IDE(IntegratedDevelopmentEnvironment)
  10. 10. (:,,) (IDE) Codeblocks http://www.codeblocks.org Downloads Binaries(codeblocks13.12mingwsetup.exe) , UbuntuSoftwareCenter(Applications>UbuntuSoftwareCenter) , , , ,(http://cpbook.subeen.com) ., , , , ??http://cpbook.subeen.com
  11. 11. ' ' http://dimikcomputing.com , http://programming-course.appspot.com
  12. 12. , HelloWorld Codeblocks , . ??http://cpbook.subeen.com
  13. 13. .
  14. 14. . ??http://cpbook.subeen.com
  15. 15. .
  16. 16. . No(.) ??http://cpbook.subeen.com
  17. 17. . Start Programs Codeblocks Applications>Programming
  18. 18. . (.)Showtipsatstartup(tick) FileNewFileEmptyFile(.) . ??http://cpbook.subeen.com
  19. 19. (Save) SaveastypeC/C++files(.) . hello.c.c .
  20. 20. #include intmain() { printf("HelloWorld"); return0; } :. . ,?,! BuildCompileCurrentFile ??http://cpbook.subeen.com
  21. 21. . 0errors,0warnings,syntax . . BuildRun(.).
  22. 22. . . ,HelloWorldProcessreturned0(0x0)( )executiontime:0.031s0.031 ,Pressanykeytocontinue. Anykey HelloWorld ??http://cpbook.subeen.com
  23. 23. :#include, :intmain(), () return0; , : intmain() { return0; } :printf(HelloWorld);printf() stdio.h(header)(.h )stdio.h, , printf() ,#include, printf(Hello World);
  24. 24. return0; , , (compileerror) #include,intmain(),{ }printfreturn0( ) (Indentation) , , , (Tab)CodeblocksSettings EditorTABOptionsTABindentsTABsizeinspaces4(.) ??http://cpbook.subeen.com
  25. 25. . :Ilovemycountry,Bangladesh
  26. 26. , , ,?! , = , , #include intmain() { inta; intb; intsum; a=50; b=60; sum=a+b; printf("Sumis%d",sum); ??http://cpbook.subeen.com
  27. 27. return0; } :. ,:Sumis110 a,b,sum(variable)a,b,sum inta;a (integer) int, , ,:inta,b,sum; : a=50; b=60; a50b60(assign),,a 50b60 :sum=a+b;,suma+b,ab sum(assign) ,printf printf(Sumis%d,sum);
  28. 28. printfSumis%dSum is%dsum %dsum%d, , , , : #include intmain() { inta,b,sum; a=50; b=60; sum=a+b; printf("Sumis%d",sum); return0; } :. ??http://cpbook.subeen.com
  29. 29. : #include intmain() { inta=50,b=60,sum; sum=a+b; printf("Sumis%d",sum); return0; } :. ? #include intmain() { intx,y;
  30. 30. x=1; y=x; x=2; printf("%d",y); return0; } :. ?12?1,,x1 (x=1;)xy(y=x;)y 1 x 2 y y=x;'=' : #include intmain() { inta=50,b=60,sum; sum=a+b; ??http://cpbook.subeen.com
  31. 31. printf("%d+%d=%d",a,b,sum); return0; } :. ?printf(%d+%d=%d,a,b,sum);printf(%d+%d=%d,b, a,sum); ,,, , ,, , ,, ,int(realnumber), ? #include intmain() { inta=50.45,b=60,sum; sum=a+b; printf("%d+%d=%d",a,b,sum);
  32. 32. return0; } :. a50.45,,main return0;?return0; :50+60=110 a50,50.45(typecast) doubledoubleint, :inta=(int)50.45 inta=50.99;a50inta=50.9;a50doubleint , #include intmain() { intn; doublex; x=10.5; ??http://cpbook.subeen.com
  33. 33. n=(int)x; printf("Valueofnis%dn",n); printf("Valueofxis%lfn",x); return0; } :. x- - double , %lf (l L) int?: #include intmain() { inta; a=1000; printf("Valueofais%d",a); a=21000; printf("Valueofais%d",a); a=10000000;
  34. 34. printf("Valueofais%d",a); a=10000000; printf("Valueofais%d",a); a=100020004000503; printf("Valueofais%d",a); a=4325987632; printf("Valueofais%d",a); return0; } :. a? printf printf:printf(Valueofais%dn,a);printfn a,21474836482147483647 ,intintint (byte)(1byte=8bit) ,01(00,01,10,11)32:232 4294967296 , 2147483648 1 2147483648021474836472147483648,4294967296 , ??http://cpbook.subeen.com
  35. 35. (realnumber), ,...3,2,1,0,1,2,3...5,3,2.43,0,0.49,2.92( ) #include intmain() { doublea,b,sum; a=9.5; b=8.743; sum=a+b; printf("Sumis:%lfn",sum); printf("Sumis:%0.2lfn",sum); return0; } :. :
  36. 36. Sumis:18.243000 Sumis:18.24 %lf ,%0.2lf(%0.3lf, %0.0lf)double641.7E308(1.7x10308 ) 1.7E+308 (1.7 x 10308 ) , , , ( ) scanf (- ) : #include intmain() { inta,b,sum; scanf("%d",&a); scanf("%d",&b); sum=a+b; printf("Sumis:%dn",sum); ??http://cpbook.subeen.com
  37. 37. return0; } :. (blank screen) , (space) (enter) scanf scanf( %d , &a); %d scanf- int ( ) a- (&) , &a a , &a- , a b- scanf : scanf( %d %d , &a, &b); & ? , , #include intmain() { inta,b,sum; scanf("%d",&a); scanf("%d",b); sum=a+b;
  38. 38. printf("Sumis:%dn",sum); return0; } :. ? scanf- %d- %lf , int double , , , , , , char (character) character , char : #include intmain() ??http://cpbook.subeen.com
  39. 39. { charch; printf("Enterthefirstletterofyourname:"); scanf("%c",&ch); printf("Thefirstletterofyournameis:%cn",ch); return0; } :. , char printf scanf %c getchar, char : #include intmain() { charch; printf("Enterthefirstletterofyourname:"); ch=getchar(); printf("Thefirstletterofyournameis:%cn",ch); return0; } :.
  40. 40. getchar ch char : char c = 'A'; : #include intmain() { intnum1,num2; printf("Pleaseenteranumber:"); scanf("%d",&num1); printf("Pleaseenteranothernumber:"); scanf("%d",&num2); printf("%d+%d=%dn",num1,num2,num1+num2); printf("%d%d=%dn",num1,num2,num1num2); printf("%d*%d=%dn",num1,num2,num1*num2); printf("%d/%d=%dn",num1,num2,num1/num2); return0; } :. ??http://cpbook.subeen.com
  41. 41. , , num1 num2- , , , printf , num2- 0 printf +, -, *, / char : #include intmain() { intnum1,num2,value; charsign; printf("Pleaseenteranumber:"); scanf("%d",&num1); printf("Pleaseenteranothernumber:"); scanf("%d",&num2); value=num1+num2; sign='+'; printf("%d%c%d=%dn",num1,sign,num2,value); value=num1num2; sign=''; printf("%d%c%d=%dn",num1,sign,num2,value);
  42. 42. value=num1*num2; sign='*'; printf("%d%c%d=%dn",num1,sign,num2,value); value=num1/num2; sign='/'; printf("%d%c%d=%dn",num1,sign,num2,value); return0; } :. , ( , - ) , (comment) // /* */ #include intmain() ??http://cpbook.subeen.com
  43. 43. { //testprogramcomment1 printf("Hello"); /*WehaveprintedHello, nowweshallprintWorld. Notethatthisisamultilinecomment*/ printf("World");//printedworld return0; } :. , ( - ), ? , a z, A Z, 0 9 _ ( ) () int 7d; , sum , y ,
  44. 44. , ??http://cpbook.subeen.com
  45. 45. ' '! -