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 ————————————

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

Program to sort a given array using selection sort

Selection sort works by repeatedly finding the smallest (or largest) element from the unsorted part of the array and putting it in its correct position in the sorted part. Steps: Start with the first element (index 0) as the minimum. Compare it with every element in the unsorted part of the array to find the […]

Program to search a number using Linear Search C and C++

Program to search a number using Linear Search

Linear search checks each element in the array one by one until the desired element is found or the array ends. Steps: Start from the first element. Compare the current element with the key (number to be searched). If it matches, return its position (index). If not, move to the next element. If the end […]

Untold Stories of 5 Famous Paintings That Changed Art Forever

Art is not just color on canvas — it’s emotion, history, mystery, and a glimpse into the artist’s soul. Behind every famous painting lies a story — sometimes beautiful, sometimes tragic, and often surprising. In this blog, we’ll uncover the fascinating stories behind some of the world’s most celebrated masterpieces. 1. Mona Lisa – Leonardo […]

ನಾನು ದೊಡ್ಡವನಾದಾಗ ಏನು ಆಗಲು ಇಚ್ಛಿಸುತ್ತೇನೆ

೧. ವೈದ್ಯ (Doctor) ನಾವು ಬೆಳೆದು ದೊಡ್ಡವರಾದ ಮೇಲೆ ಏನಾಗಬೇಕು ಎಂದು ಪ್ರತಿಯೊಬ್ಬರಿಗೂ ಒಂದು ಕನಸು ಇರುತ್ತದೆ. ನಾನು ವೈದ್ಯನಾಗಬೇಕು/ವೈದ್ಯಳಾಗಬೇಕು ಅಂದುಕೊಂಡಿದ್ದೇನೆ. ನಾನು ಬೆಳೆದು ದೊಡ್ಡವನಾದ ಮೇಲೆ, ವೈದ್ಯನಾಗಲು ಬಯಸುತ್ತೇನೆ. ವೈದ್ಯರು ಅನಾರೋಗ್ಯದಿಂದ ಬಳಲುತ್ತಿರುವ ಅಥವಾ ಗಾಯಗೊಂಡ ಜನರಿಗೆ ಚಿಕಿತ್ಸೆ ನೀಡಿ ಗುಣಪಡಿಸುತ್ತಾರೆ. ನಾನು ರೋಗಿಗಳ ಮಾತನ್ನು ಕೇಳುವ, ಅವರಿಗೆ ಉತ್ತಮ ಚಿಕಿತ್ಸೆ ನೀಡುವ ದಯೆ ಮತ್ತು ಕಾಳಜಿಯುಳ್ಳ ವೈದ್ಯನಾಗಲು ಬಯಸುತ್ತೇನೆ. ವೈದ್ಯರು ಜೀವಗಳನ್ನು ಉಳಿಸುವುದರಿಂದ ಅವರು ಬಹಳ ಮುಖ್ಯ ಎಂದು ನಾನು ಭಾವಿಸುತ್ತೇನೆ. ಕೆಲವೊಮ್ಮೆ ಜನರಿಗೆ […]

What I Want to Be When I Grow Up

1. Doctor Everyone has a dream of what they want to become when they grow up. I want to become a doctor. When I grow up, I want to be a doctor. Doctors help people feel better when they are sick or hurt. I want to be a kind and caring doctor who listens to […]