Linear Search in C++

Here you will get program for linear search in C++. In linear search algorithm, we compare targeted element with each element of the array. If the element is found then its position is displayed. The worst case time complexity for linear search is O(n). Program for Linear Search in C++ #include<iostream> using namespace std; int main() …

Linear Search in C++ Read More »

C++ Program to Create Facebook Login Screen

Actually this program doesn’t creates a facebook login screen. I have just used graphics to create two boxes with an option to enter username and password. This is program is to just give you an idea that how you can create a login screen for your project. #include<conio.h> #include<iostream.h> #include<graphics.h> #include<stdio.h> #include<dos.h> #include<process.h> void logo() …

C++ Program to Create Facebook Login Screen Read More »

C++ Program to print following triangle:

         *       *  *      *    *     ***** code: #include<iostream.h>#include<conio.h> void main(){ clrscr(); int i,k,j,n; cout<<“Enter size of triangle in odd number(min-5,ex-5,7,9):”; cin>>n; cout<<“nt”; for(i=1;i<=n;i+=2) { for(j=n;j>i;j-=2) cout<<” “; for(k=1;k<=i;++k) { if(i==n) cout<<“*”; else if(k==1||k==i) cout<<“*”; else cout<<” “; } cout<<“nt”; } getch();}

C++ Program to print following triangle:

      *     **   *** ****code: #include<iostream.h>#include<conio.h> void main(){ clrscr(); int i,n,j,k; cout<<“Enter size of triangle(ex-5):”; cin>>n; cout<<“nt”; for(i=0;i<n;++i) { for(j=n;j>i;–j) cout<<” “; for(k=0;k<+i;++k) cout<<“*”; cout<<“nt”; } getch();}