পোস্টগুলি

জুলাই, ২০১৬ থেকে পোস্টগুলি দেখানো হচ্ছে

Fan design using Computer Graphics (cpp)

ছবি
                                         Fan design using Computer Graphics (cpp) //Faisal Porag //Computer Graphics /* স্বপ্নের প্রতিবিম্ব...  **/ #include <iostream> #include <stdlib.h> #include <math.h> #include <GL/glut.h> /*Faisal porag Computer science and Engineering department in American International University-Bangladesh*/ //Initializes 3D rendering void initRendering() { glEnable(GL_DEPTH_TEST); } //Called when the window is resized void handleResize(int w, int h) { glViewport(0, 0, w, h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (double)w / (double)h, 1.0, 200.0); } float _angle = 0.0; float _cameraAngle = 0.0; float _ang_tri = 0.0; //Draws the 3D scene void drawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); //Switch to the drawing perspective glLoadIdentity(); //Reset the drawing perspective glRotatef(-_cameraAngle, 0.0, 1.0,

Write a program which takes some input into an Array from console and finds the second last occurrence of a number from that array.

Problem Number : 3 Write a program which takes some input into an Array from console and finds the second last occurrence of a number from that array. (print the index) Sample Input: 10 15 2 35 11 9 7 2 47 13 2 2 Sample Output: 7 Source code :  Download Solution for this problem : <?php //echo "Hello World !"; echo "<br/>"; $a=array(10,15,2,35,11,9,7,2,47,13,2); $count=0;   for($i=count($a)-1;$i>0;$i--) { if($a[$i]==2) { $count++; } if($count==2){ break; } } echo $i; // echo $count; echo "<br/>"; echo "<br/>"; ?> Sample Input: 10 15 2 35 11 9 7 2 47 13 2 2 Sample Output: 7

Write a program which takes a string as input and finds the number of occurrence of “i”.

Problem number : 2 Write a program which takes a string as input and finds the number of occurrence of “i”. Sample Input: University Sample Output: 2 Solution For this problem : <?php //echo "Hello World !"; echo "<br/>"; $name="university"; $count=0;   for($i=0;$i<strlen($name);$i++) { if($name[$i]=="i") { $count++; } } echo $count; echo "<br/>"; echo "<br/>"; ?> Sample Input: University Sample Output: 2

Write a program which can print the following sequences: Sample Output: 1, 10, 100, 1000, ……, N 1, 3, 6, 10, 15, ……, N

Problem number : 1  Write a program which can print the following sequences: Sample Output: 1, 10, 100, 1000, ……, N 1, 3, 6, 10, 15, ……, N Solution for this problem : <?php //echo "Hello World !"; echo "<br/>"; $a=1;   for($i=0;$i<4;$i++){ echo $a; echo ",&nbsp;"; $a=$a*10; } echo "...... , N"; echo "<br/>"; echo "<br/>"; $n=1; for($j= 0; $j < 5; $j++){ $res = $n*($n+1)/2; echo $res; $n++; echo ",&nbsp;"; } echo "...... , N"; echo "<br/>"; echo "<br/>"; ?> Sample Output: 1, 10, 100, 1000, ……, N 1, 3, 6, 10, 15, ……, N