Computer Graphics

Joysticks

➢ Joystick is used as a positioning device,which uses a small vertical lever(stick) mounded on a base.It is used to steer the screen cursor around and select screen position with the stick movement. ➢ A push or pull on the stick is measured with strain gauges and converted to movement of the screen cursor in […]

Computer Graphics

Trackballs and Spaceballs

➢ A trackball is a ball device that can be rotated with the fingers or palm of the hand to produce screen cursor movement. ➢ Laptop keyboards are equipped with a trackball to eliminate the extra space required by a mouse. ➢ Spaceball is an extension of two-dimensional trackball concept. ➢ Spaceballs are used for […]

Computer Graphics

Disadvantages of encoding

❖ The disadvantages of encoding runs are that color changes are difficult to record and storage requirements increase as the lengths of the runs decrease. ❖ In addition, it is difficult for the display controller to process the raster when many short runs are involved. ❖ Moreover, the size of the frame buffer is no […]

Computer Graphics

Different methods to draw a curve

Method 1: Using circle symmetry property, we generate the circle path with vertical spans in the octant from x = 0 to x = y, and then reflect pixel positions about the line y = x to y=0 Method 2: Another method for displaying thick curves is to fill in the area between two Parallel […]

OS

Define Atomic Actions & explain its characteristics

Typically, system activity is governed by the sequence of primitive or atomic operations it is executing. Usually, a machine level instruction, which is indivisible, instantaneous, and cannot be interrupted ( unless the system fails), corresponds to an atomic operation. However, it is desirable to be able to group such instructions that accomplish a certain task […]

C and C++

Write a program to find the frequency of presence of an element in an array

#include<iostram.h> #include<iomanip.h> #include<conio.> class frequency{     private:          int n, m[100], ele, freq;     public:          void getdata();         void findfreq();         void display();      }; void frequency::getdata(){     cout<<“Enter the size of the array: “;     cin>>n;     cout<<“Enter “<<n<<” elemens into the array: “;     for(int i=0; i<n; i++)     cin>>m[i];     cout<<“Enter the search element: “;     cin>>ele; } void frequency::findfreq(){     freq = 0;     for (int i=0; i<n; i++)     if(m[i] == ele)     freq++; } void frequency::display(){     if(freq > 0)     count<<“Frequency of “<<ele<<” is “<<freq;     else     cout<<ele<<” does not exist”; } void main(){     frequency F;     clrscr();     F.getdata();     F.findfreq();     F.display();     getch(); }   OUTPUT: ——————- Enter the size of the array: 5 Enter 5 elements into the array: 10 50 40 30 40 Enter the search element: 40 Frequency of 40 is 2 ——————– ——————- Enter the size of the array: 5 Enter 5 elements into the array: 10 50 40 30 40 Enter the search element: 35 25 does not exist ——————–

Computer Graphics

OpenGL Bézier-Spline Curve Functions

We specify parameters and activate the routines for Bézier-curve display with the OpenGL functions glMap1* (GL_MAP1_VERTEX_3, uMin, uMax, stride, nPts, *ctrlPts); glEnable (GL_MAP1_VERTEX_3); We deactivate the routines with glDisable (GL_MAP1_VERTEX_3); where,  A suffix code of f or d is used with glMap1 to indicate either floating-point or doubleprecision for the data values. Minimum and maximum […]

C++ C and C++

Program to illustrate a static data member & create 3 object & count the no. of object using static data member count

#include<iostream.h> #include<conio.h>  class item{     ststic int count;     int number;     public:     void getdata(){         cin>>number;         count++;     }     void getcount(void)     {         cout<<“count:”<<count<<endl;     } }; int item::count; //——-Main Program— int main(){     item a,b,c;     clrscr();     cout<<“———-\n”;     cout<<“Before reading data\n”;     a.getcount();     b.getcount();     c.getcount();     cout<<“———————————-\n”;     cout<<“Enter value to object a\n”;     a.getdata();     cout<<“Enter value to object b\n”;     b.getdata();     cout<<“Enter value to object b\n”; […]

Program to sort a given array using bubble sort C and C++

Program to sort a given array using bubble sort

Bubble sort is a simple sorting algorithm. The algorithm starts at the beginning of the data set. It compares the first two elements, and if the first is greater than the second, it swaps them. It continues doing this for each pair of adjacent elements to the end of the data set. It then starts […]

C++ C and C++

C++ program for the simple interest using dynamic initialization

#include<iostream.h> #include<conio.h> class SI{         int P, T;         float R, Interest;     Public:         SI(){         }     SI(int P1, int T1, float R1)     {         P=P1;         T=T1;         R=R1;         Interest=(P*T*R)/100;     }     float     {         return(Interest);     } }; //—————————————– void main() {     SI s1;     int p,t;     float r;     clrscr();     cout<<“—————————————-\n”;     cout<<“Enter the value for Principal amount:”;     cin>>p;     cout<<“\n Enter the value for time:”;     cin>>t;     cout<<“\n Enter the value for rate:”;     cin>>r;     cout<<“\n ———————————\n”;     s1=SI(p,t,r);     cout<<“The Simple Interest =”<<s1.show()<<endl;     cout<<“————————————–\n”;     getch(); } OUTPUT: ———————————– Enter the value for Principal amount: 4515 Enter the value for time: 5 Enter the value for rate: 10.8 ———————————— The Simple Interest = 2438.100098 ———————————— ———————————– Enter the value for Principal amount: 3000 Enter the value for time: 4 Enter the value for rate: 5.5 ———————————— The Simple Interest = 660 ————————————