ssd
🧩 Syntax:
#include<iostream>
using namespace std;
string Title[5]={{"AccountNum"},{"CustomerName"},{"NIC_number"},{"AccountType"},{"Balance"}};
long long int AccNum[5]={4810055992,4962006345,4753008741,3345256348,4954083265};
string CustomerName[5]={{"Tom Lara"},{"Simon David"},{"Ben Stacy"},{"John Mark"},{"Cooper Jake"}};
string NicNum[5]={{"965622411V"},{"931122456V"},{"927391333V"},{"961343267V"},{"967591530V"}};
string AccType[5]={{"Saving "},{"Current "},{"Fixed "},{"Current "},{"Saving "}};
double Balance[5]={153000,25000,85000,62000,178000};
void displaymenu()
{
cout<<"------Welcome to Bank of Northen------"<<endl<<endl;
cout<<"1 - Customer Details"<<endl;
cout<<"2 - Search Account Details"<<endl;
cout<<"3 - Deposit"<<endl;
cout<<"4 - Withdrawal"<<endl;
cout<<"5 - Interest"<<endl;
}
void displayaccount()
{
for (int i = 0; i < 5; i++)
{
cout<<Title[i]<<"\t";
}
cout<<endl;
for (int i = 0; i < 5; i++)
{
cout<<AccNum[i]<<"\t";
cout<<CustomerName[i]<<"\t";
cout<<NicNum[i]<<"\t";
cout<<AccType[i]<<"\t";
cout<<Balance[i]<<endl;
}
}
double searchaccount()
{
string num;
cout<<"Enter NIC Number:";
cin>>num;
int i=0;
for (int i = 0; i < 5; i++)
{
if (num==NicNum[i])
{
cout<<AccNum[i]<<"\t";
cout<<CustomerName[i]<<"\t";
cout<<NicNum[i]<<"\t";
cout<<AccType[i]<<"\t";
cout<<Balance[i]<<endl;
}
}
}
double deposit()
{
double num;
cout<<"Enter ACC Number:";
cin>>num;
int i=0;
double total,newbalance=0;
for (int i = 0; i < 5; i++)
{
if (num==AccNum[i])
{
cout<<"Enter Amount You want to Deposit:";
cin>>total;
cout<<endl;
newbalance=Balance[i]+total;
Balance[i]=newbalance;
for (int i = 0; i < 5; i++)
{
cout<<Title[i]<<"\t";
}
cout<<endl;
for (int i = 0; i < 5; i++)
{
cout<<AccNum[i]<<"\t";
cout<<CustomerName[i]<<"\t";
cout<<NicNum[i]<<"\t";
cout<<AccType[i]<<"\t";
cout<<Balance[i]<<endl;
}
}
}
}
double withdrow()
{
double num;
cout<<"Enter ACC Number:";
cin>>num;
int i=0;
double total,newbalance=0;
for (int i = 0; i < 5; i++)
{
if (num==AccNum[i])
{
cout<<"Enter Amount You want to Withdrow Money:";
cin>>total;
cout<<endl;
if (Balance[i]>=total)
{
newbalance=Balance[i]-total;
Balance[i]=newbalance;
for (int i = 0; i < 5; i++)
{
cout<<Title[i]<<"\t";
}
cout<<endl;
for (int i = 0; i < 5; i++)
{
cout<<AccNum[i]<<"\t";
cout<<CustomerName[i]<<"\t";
cout<<NicNum[i]<<"\t";
cout<<AccType[i]<<"\t";
cout<<Balance[i]<<endl;
}
}
else
{
cout<<"Sorry....You Dont have Enough Money...!!!!"<<endl;
}
}
}
}
double intrest()
{
double intrest[5]={};
double currntbalance[5]={};
int i=0;
double intres=0;
for (int i = 0; i < 5; i++)
{
if (AccType[i]=="Saving ")
{
intres=((Balance[i]*10)/100);
intrest[i]=intres;
currntbalance[i]=(intres+Balance[i]);
}
else if (AccType[i]=="Current ")
{
intres=((Balance[i]*8)/100);
intrest[i]=intres;
currntbalance[i]=(intres+Balance[i]);
}
else if (AccType[i]=="Fixed ")
{
intres=((Balance[i]*13)/100);
intrest[i]=intres;
currntbalance[i]=(intres+Balance[i]);
}
}
for (int i = 0; i < 5; i++)
{
cout<<Title[i]<<"\t";
}
cout<<"Intrest"<<"\t";
cout<<"CurrentBalance"<<"\t";
cout<<endl;
for (int i = 0; i < 5; i++)
{
cout<<AccNum[i]<<"\t";
cout<<CustomerName[i]<<"\t";
cout<<NicNum[i]<<"\t";
cout<<AccType[i]<<"\t";
cout<<Balance[i]<<"\t";
cout<<intrest[i]<<"\t";
cout<<currntbalance[i]<<endl;
}
}
int main()
{
char choice,flag;
do
{
displaymenu();
cout<<"Enter Your Choice(1-4):";
cin>>choice;
switch (choice)
{
case '1':
displayaccount();
break;
case '2':
searchaccount();
break;
case '3':
deposit();
break;
case '4':
withdrow();
break;
case '5':
intrest();
break;
default:
cout<<"Wrong Input Please Try Again.....!!!!!!";
break;
}
cout<<"Do you want to run this programe again?(y,n):";
cin>>flag;
cout<<endl;
} while (flag=='Y'|| flag=='y');
cout<<"----We Appriciate You Using This App----";
}
#include<iostream>
using namespace std;
int main()
{
//a.Create an array and initialize all the values in that array
string countries[]={"India ","China ","UK ","Germany ","Maldives ","France ","Australia","Russia ","USA ","Canada "};
string subjects[]={"Country ","Vacation ","Relations ","Business","Health","Sports ","Official"};
int values[10][6]={{292933,28923,18188,503,1885,416},
{243181,24393,1627,31,215,51},
{134872,46965,2177,382,1292,165},
{116363,9677,759,5405,128,86},
{8927,6234,374,60,53,160},
{87133,8030,567,155,94,83},
{45021,26950,777,103,648,207},
{57939,160,29,9,0,4},
{38852,11310,1479,177,247,1001},
{15057,28138,354,47,117,104}};
//b.Display the array as shown in the Table: SL-TOURIST
for(string i:subjects)
{
cout<<i<<" ";
}
cout<<endl;
//cout<<sizeof(values)/sizeof(int)<<endl;
for(int row=0;row<10;row++)
{
cout<<countries[row]<<" ";//india//
for(int column=0;column<6;column++)
{
cout<<values[row][column]<<"\t";
}
cout<<endl;
}
cout<<endl;
cout<<endl;
//c.Show the total number of travelers who came to Sri Lanka in 2016.
int totalvisitors=0;
for(int row=0;row<10;row++)//0
{
for(int column=0;column<6;column++)//0//1//2
{
totalvisitors+=values[row][column];//01
}
}
cout<<"Total number of travelers who came to Sri Lanka in 2016: "<<totalvisitors<<endl;
cout<<endl;
cout<<endl;
//d.Calculate the number of tourists in each country.
for(int row=0;row<10;row++)
{
int totalcountry=0;
cout<<"Total Number of tourists from "<<countries[row]<<" ";//INDIA
for(int column=0;column<6;column++)
{
totalcountry+=values[row][column];
}
cout<<totalcountry<<endl;
}
cout<<endl;
cout<<endl;
//e.Calculate the total amount of business travelers who came to Sri Lanka in 2016
int businesstravelers=0;
for(int row=0;row<10;row++)//0//1//2
{
for(int column=2;column<=2;column++)//2//3
{
businesstravelers+=values[row][column];
}
}
cout<<"Total amount of business travelers who came to Sri Lanka in 2016: "<<businesstravelers<<endl;
cout<<endl;
cout<<endl;
//f.Calculate the total number of tourists who visited Sri Lanka in 2016 from the USA.
int usatourist=0;
for(int column=0;column<6;column++)
{
usatourist+=values[8][column];
//cout<<usatourist<<endl;
}
cout<<"Total number of tourists who visited Sri Lanka in 2016 from the USA:"<<usatourist<<endl;
cout<<endl;
cout<<endl;
//g.Display the maximum number of tourists who visited Sri Lanka in 2016.
int max=0;
for(int row=0;row<10;row++)
{
for(int column=0;column<6;column++)
{
if(max<values[row][column])//0<292933//292933<28923
{
max=values[row][column];
}
}
}
cout<<"the maximum number of tourists: "<<max<<endl;
cout<<endl;
cout<<endl;
//h.Which country sent out the most visitors to Sri Lanka for the sports in 2016
int sportmax=0;
int sprow;
for(int row=0;row<10;row++)//0//1
{
for(int column=4;column<=4;column++)
{
if(sportmax<values[row][column])//0<1885//1885<215
{
sportmax=values[row][column];//1885
sprow=row;//0
}
}
}
cout<<countries[sprow]<<"sent out the most visitors to Sri Lanka for the sports in 2016"<<endl;
cout<<endl;
cout<<endl;
//i.Display the country name that you want to visit from Sri Lanka
cout<<"I want to visit from Sri Lanka to "<<countries[4];
return 0;
}
#include<iostream>
using namespace std;
int main()
{
string str1;
cout<<"Enter the Word:"<<endl;
cin>>str1;
int length=str1.length();//AMMA
//cout<<length<<endl;
int flag=0;
for(int i=0,j=length-1;i<length;i++,j--)//I=0,J=3//I=1,J=2
{
if(str1[i]!=str1[j])//A,A//M,M
{
flag=1;
break;
}
}
if(flag==1)
cout<<str1<<" is Not a Palindrome"<<endl;
else
cout<<str1<<" is a Palindrome"<<endl;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n,num,digit,rev=0;
cout<<"Enter the number ";
cin>>num;
n=num;
do
{
digit=num%10;
rev=(rev*10)+digit;
num=num/10;
}while(num!=0);
if(n==rev)
cout<<"\nThe number is palindrome";
else
cout<<"\nThe number is not palindrome";
}
#include<iostream>
using namespace std;
string topic[3]={"Mark Range","Grade","GPV"};
string Mark_Range[4][2]={{"Between 80 and 100","A"},{"Between 60 and 79","B"},{"Between 40 and 59","C"},{"Below 40","E"}};
double GPV[4]={4.0,3.0,2.0,0.0};
double Marks[100];
double M,GPA,SUM=0;
int x,y;
double findgrade(){
for (int i = 0; i < x; i++)
{
if (Marks[i]>80)
{
cout<<"Subject "<<i+1<<": "<<"Grade A"<<endl;
}
else if (Marks[i]>60)
{
cout<<"Subject "<<i+1<<": "<<"Grade B"<<endl;
}
else if (Marks[i]>40)
{
cout<<"Subject "<<i+1<<": "<<"Grade C"<<endl;
}
else
{
cout<<"Subject "<<i+1<<": "<<"Grade E"<<endl;
}
}
}
double findGPV(){
for (int j = 0; j < x; j++)
{
if (Marks[j]>80)
{
y=GPV[0];
}
else if (Marks[j]>60)
{
y=GPV[1];
}
else if (Marks[j]>40)
{
y=GPV[2];
}
else
{
y=GPV[3];
}
SUM=SUM+y;
}
GPA=SUM/x;
cout<<"GPA : "<<GPA<<endl;
}
int main(){
cout<<"Enter the number of subjct :";
cin>>x;
Marks[x];
for (int i = 0; i < x; i++)
{
cout<<"Enter mark for subject "<<i+1<<": ";
cin>>M;
Marks[i]=M;
M=0;
}
findgrade();
findGPV();
return 0;
}
#include<iostream>
using namespace std;
void employeeDtails();
int choiseMenu();
int netPay();
int grossPay();
void EPF_PTF(float epf,float ptf);
void Annual_EPF_PTF(float epf,float ptf);
int totalAllwance();
void salarySheet();
string employeeName,department,designation;
int employeeNumber,basicSlary;
float EPF,PTF;
int main(){
char again;
do{
int option=choiseMenu();
switch (option){
case 1:
employeeDtails();
break;
case 2:
cout<<"Net Pay: "<<netPay()<<endl;
break;
case 3:
grossPay();
cout<<"Gross Pay: "<<grossPay()<<endl;
case 4:
EPF_PTF(0.03,0.15);
break;
case 5:
Annual_EPF_PTF(0.03,0.15);
break;
case 6:
cout<<"Total Allwance: "<<totalAllwance()<<endl;
break;
case 7:
salarySheet();
break;
default:
cout<<"invalid Option!\n";
break;
}
cout<<"run again?: ";
cin>>again;
}while(again=='y' || again=='Y');
cout<<"---------------";
}
int choiseMenu(){
int choice;
cout<<"1 - employee details"<<endl;
cout<<"2 - Netpay"<<endl;
cout<<"3 - Grosspay"<<endl;
cout<<"4 - EPF PTF"<<endl;
cout<<"5 - Anual EPF PTF"<<endl;
cout<<"6 - Total Allwance"<<endl;
cout<<"7 - Salary Sheet"<<endl;
cout<<"Choise: ";
cin>>choice;
return choice;
}
void employeeDtails(){
cout<<"employee name: ";
cin>>employeeName;
cout<<"employee number: ";
cin>>employeeNumber;
cout<<"Department: ";
cin>>department;
cout<<"Designation: ";
cin>>designation;
cout<<"Basic Salary: ";
cin >>basicSlary;
}
int netPay(){
int electrycityBill=4500;
int houserRent=20000;
return electrycityBill+houserRent;
}
int grossPay(){
int gross_pay=netPay()+basicSlary;
return gross_pay;
}
void EPF_PTF(float epf,float ptf){
EPF=basicSlary*epf;
PTF=basicSlary*ptf;
cout<<"EPF: "<<EPF<<endl;
cout<<"PTF: "<<PTF<<endl;
}
void Annual_EPF_PTF(float epf,float ptf){
cout<<"Annual EPF: "<<EPF*12<<endl;
cout<<"Annual PTF: "<<PTF*12<<endl;
}
int totalAllwance(){
int total=grossPay()-(EPF+PTF);
return total;
}
void salarySheet(){
cout<<"--Salary Sheet--\n";
cout<<"Employee Name "<<employeeName<<endl;
cout<<"department: "<<department<<endl;
cout<<"designation: "<<designation<<endl;
cout<<"Net Pay: "<<netPay()<<endl;
cout<<"Gross Pay: "<<grossPay()<<endl;
EPF_PTF(0.03,0.15);
Annual_EPF_PTF(0.03,0.15);
cout<<"Total Allwance: "<<totalAllwance()<<endl;
}