Posts

Showing posts from July, 2021

C++ Program for Search And Replace in A String

 #include<iostream> #include<iomanip> #include<string.h> using namespace std; void line() { cout<<"========================================\n"; } void stringprogram() { int i,n,len=0,g=0; char arr[20],ch,ch1=0; line(); cout<<"String Programs #18\n"; line(); cout<<"Enter Any values to the String :"; cin.getline(arr,20); line(); for(n=0;arr[n]!='\0';n++); cout<<"Enter Whatever you want to search :"; cin>>ch; cout<<"Enter Whatever you want to replace :"; cin>>ch1; for(i=0;i<n;i++)     {     if(arr[i]==ch)     { arr[i]=ch1; len++; }     }     if(len==0)     cout<<"number not found..."; cout<<arr<<"  "; } int main() { stringprogram(); }

C++ String Program for finding number of vowels in the String

#include<iostream> #include<iomanip> #include<string.h> using namespace std; void line() {      cout<<"=========================================\n"; } int main() {   int i,flag=0; char arr[20]; line(); cout<<"String Programs #10\n"; line(); cout<<"Enter anything in the String :"; cin.getline(arr,20); line(); for(i=0;arr[i]!='\0';i++) { switch(arr[i]) { case 97:flag++;break; case 101:flag++;break; case 105:flag++;break; case 111:flag++;break; case 117:flag++;break; case 65:flag++;break; case 69:flag++;break; case 73:flag++;break; case 79:flag++;break; case 85:flag++;break; } } arr[i]='\0'; cout<<"number of vowels :"<<flag; }

C++ Program for Electricity Billing Details

 #include<iostream> #define r1 2.50 #define r2 3.50 #define r3 4.75 #define r4 6.50 using namespace std; int main() { char name[20]; float units,charges,gst,amount;     cout<<"\tElectricity Billing | If Else Ladder\n"; cout<<"Enter Your Name :"; cin.getline(name,20); cout<<"Enter Units consumed :"; cin>>units; if(units<=100) charges=units*r1; else if(units>100 && units<=300) charges=(units-100)*r2+100*r1; else if(units>300 && units<=600) charges=(units-300)*r3+200+200*r2+100*r1; gst=charges*0.05; amount=charges+gst; cout<<endl; cout<<"============================\n"; cout<<"\t\tBILLING DETAILS\n"; cout<<"============================\n"; cout<<"CLient name            :"<<name<<endl; cout<<"Units Consumed         :"<<units<<" Units...

C++ Program for Printing Table of Entered Number

#include<iostream> #include<iomanip> using namespace std;int main() { int i=1,n=1,p=0; cout<<"Printing table of N: "; cin>>n; i=1; while(i<=10) { cout<<setw(2)<<n<<" x "<<setw(2)<<i<<" = "     <<setw(4)<<n*i<<endl; i++; } }

C++ Program for Printing Sum of Numbers till N

 #include<iostream> using namespace std; int main() { int i ,n ,s=0, t=0; cout<<"Printing sum of numbers till N: "; cin>>n; i=1; while(i<=n) { cout<<i<<" + "; s=s+i; t+=s; i++; } cout<<"\b\b = "<<s<<endl; }

C++ Program for Printing Numbers from N till 1

 #include<iostream> #include<iomanip> using namespace std; int main() { int i,n; cout<<"============================\n"; cout<<" Printing Number in Reverse\n"; cout<<"============================\n"; cout<<"Enter N: "; cin>>n; for(i=n;i>=1;i--) { cout<<setw(4)<<i; }     return 0; }

C++ Program for Printing Even Numbers till N

 #include<iostream> using namespace std; int main() { int i,n; cout<<"Printing Even numbers till N :"; cin>>n; i=1; while(i<=n) { if(i%2==0) { cout<<i<<", "; } i++; } return 0; }

CSS code for DIV Layout Practice#2

Image
<!doctype html> <html> <head>     <style type="text/css">         * {             margin: 0;             padding: 0;         }         #container {             width: 100%;             height: 930px;             background-color: aqua;         }         #leftbig {             border: 2px solid black;             width: 75%;             height: 848px;             background-color: white;         }         #usandaus {             margin: 2px;             width: 60%;         ...

CSS code for DIV Layout Practice #1

Image
  <!doctype html> <html> <head>     <style type="text/css">         #bigmain{                          background-color:black;             width:100%;             height: 735px;         }         #forred {             border-radius:18px;             float: left;             background-color: red;             width: 50%;             height: inherit;         }         #name{             border-radius:18px;             float: right;             background-color:chartreuse;       ...

C++ Basic TypeDef Program

 #include<iostream> using namespace std; typedef int number; typedef char String[80]; typedef float fees; int main() {      number adm_no;     String name;     fees admission;     cout<<"====================================\n";     cout<<"\tEXAMPLE OF TYPEDEF\n";     cout<<"====================================\n";     cout<<"Student Name     :";     cin>>name;     cout<<"Admission No.    :";     cin>>adm_no;     cout<<"Admission Fees   :";     cin>>admission;     cout<<"\nDetails entered by you are:\n";     cout<<"Name       : "<<name<<endl;     cout<<"Adm. No.   : "<<adm_no<<endl;     cout<<"Adm. Fees  : "<<admission<<endl;   ...

C++ Program to Print Fibonacci Series Till N

#include <iostream> using namespace std; int main() {   int i,n,n1=0,n2=1,n3; line(); cout<<"Fibionacci series Till N\n"; line(); cout<<"Enter N: "; cin>>n; line(); for(i=1;i<=n;i++) { cout<<n1<<", "; n3=n1+n2; n1=n2; n2=n3; } cout<<"\b\b ="<<n3<<endl;{     int n,n1=0,n2=1,nextTerm=0;     cout<<"Enter the number of terms: ";     cin>>n;     cout<<"Fibonacci Series: ";     for(int i=1;i<=n;++i) {         // Printing the first two terms.         if(i == 1) {             cout<<n1<<", ";             continue;         }         if(i == 2) {             cout<<n2<<", ";             continue; ...

C++ Menu Driven Program with Area, Perimeter and Volume

 #include<iostream> #define pi 3.14 using namespace std; int main() { int ch,ch1; float r,l,b,w,h,s,a,s1,s2,area,peri,vol; system("cls"); cout<<"===========================================\n"; cout<<"\tMenu Of Programs | Nested Switch\n"; cout<<"===========================================\n"; cout<<"1. Area Programs\n"; cout<<"2. Perimeter programs\n"; cout<<"3. Volume Programs\n"; cout<<"Enter your Choice    :"; cin>>ch; switch(ch) { case 1: system("cls"); cout<<"===========================================\n"; cout<<"\t\tMenu of Area Programs\n"; cout<<"===========================================\n"; cout<<"1.Circle\n"; cout<<"2.Rectangle\n"; cout<<"3.Square\n"; cout<<"4.Trian...