## C++ Program to Find LCM and HCF of two numbers

#include<iostream.h> #include<conio.h> void main() { clrscr(); int a,b,hcf,lcm,max,min,r; cout<<“Enter two numbers:”; cin>>a>>b; if(a>b) { max=a; min=b; } else if(b>a) { max=b; min=a; } if(a==b) hcf=a; else { do { r=max%min; max=min; min=r; }while(r!=0); hcf=max; } lcm=(a*b)/hcf; cout<<“nLCM=”<<lcm<<“nHCF=”<<hcf; getch(); }

## High/Low Game

#include<iostream.h> #include<conio.h> #include<stdlib.h> #include<process.h> #include<dos.h> void main() { textbackground(WHITE); textcolor(RED);      C: clrscr();  char ch,a[20],ch2;  int num=100,rnum,guess,count,ch1,c=0;  cout<<“nttt******************************”<<“nttt******************************”;  cout<<“nttt**                          **”<<“nttt** Welcome To High/Low Game **”<<“nttt** ________________________ **”;  cout<<“nttt**                          **”<<“nttt******************************”<<“nttt******************************”;  cout<<“nnnn————“<<“n …

## C++ Program to do Addition,subtraction and multiplication of two numbers using function

#include<iostream.h> #include<conio.h> int res; void main() { clrscr(); int sum(int,int); int sub(int,int); int mul(int,int); int a,b,m,su,s; cout<<“Enter two numbers:”; cin>>a>>b; s=sum(a,b); su=sub(a,b); m=mul(a,b); cout<<“Sum:”<<s<<“nSubtraction:”<<su<<“nMultiplication:”<<m; getch(); } sum(int a,int b) { res=a+b; return(res); } sub(int a,int b) { res=a-b; return(res); } mul(int a,int b) { res=a*b; return(res); }

## C++ Program to do arithmetic operations according to user choice using switch case

include<iostream.h> #include<conio.h> void main() {       clrscr(); int a,b; char c; cout<<“Enter any expression(ex:3*7):”; cin>>a>>c>>b; switch(c) { case’+’: cout<<“nResult:”<<a+b; break; case’-‘: cout<<“nResult:”<<a-b; break; case’*’: cout<<“nResult:”<<a*b; break; case’/’: cout<<“nResult:”<<a/b; break; case’%’:  cout<<“nResult:”<<a%b; break; } getch(); }

## C++ Program to convert first letter of each word of a string to uppercase and other to lowercase

#include<iostream.h> #include<conio.h> #include<stdio.h> #include<ctype.h> void main() { clrscr(); int i; char a[30]; cout<<“Enter a string:”; gets(a); for(i=0;a[i]!=’’;++i) { if(i==0) { if(islower(a[i])) a[i]=toupper(a[i]); } else { if(a[i]!=’ ‘) { if(isupper(a[i])) a[i]=tolower(a[i]); } else { i++; if(islower(a[i])) a[i]=toupper(a[i]); } } } cout<<“nnNew string is: “<<a; getch(); }

## C++ Program to Find Highest and Lowest Element of a Matrix

Here you will get a C++ program to find highest or largest and lowest or smallest element of a matrix. Output Enter no. of rows and columns:3 3 Enter matrix: 3 5 9 15 6 0 12 4 7 Highest Element:15 Lowest Element:0

## C++ Program to Count Number of Words in String

Here you will get C++ program to count number of words in string. First we initialize a counter variable to 1. Now iterate through string and count all the spaces, for each space increase the value of counter. Finally print the counter variable, it contains the number of words. Output Enter a string:how are you …

## C++ Program to Concatenate Two Strings

Here you will get C++ program to concatenate two string without using library function. Below program will read two strings from user and then concatenate them to form third string. Output Enter first string:Hello Enter second string:World The concatenated string is HelloWorld