Neeraj Mishra

A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

C++ Program to Print an Alphabet from A to L of *’s in Capital Letter

#include<iostream> using namespace std; int main() { int i,j,k=1; char ch; cout<<“Input an Alphabet in capital letters that you want to print:”; cin>>ch; cout<<“nnnn”; switch(ch) { case ‘A’: cout<<“ttt    “; for(i=1;i<=40;++i) { for(j=0;j<=22;++j) { if(i==1||i==2||i==21||i==20) cout<<“*”; else { if(j==0||j==20) cout<<“**”; else cout<<” “; } } cout<<“nttt    “; } break; case ‘B’: cout<<“tttt”; while(k<=2) { for(i=1;i<=9;++i) …

C++ Program to Print an Alphabet from A to L of *’s in Capital Letter Read More »

C++ Program to Find ASCII value of a character

#include<iostream.h>                #include<conio.h> void main(){ clrscr(); char ch,c; int cha; cout<<“Enter a character:”; cin>>ch; cha=ch; cout<<“nASCII value of “<<ch<<” is “<<cha; c=ch+1; cha=c; cout<<“nAdding one to the character:”<<“nASCII value of “<<c<<” is “<<cha; getch();}

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 …

High/Low Game Read More »

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); }