Upload
puneet-mehta
View
219
Download
0
Embed Size (px)
Citation preview
7/30/2019 Vivek's Assignment
1/19
Assignment CSE202
Date of allocation: 25/09/2012 Date of Submission: 19/09/2012
1. Write a program to enter values into a two 2-D arrays. Perform multiplication of the
arrays and find and display the sum of both left and right diagonal of the resulting array.
(5 Marks)
Ans:
#include
#include
void main()
{
clrscr();
int a[10][10],b[10][10],c[10][10],m,n,o,p,i,j;
coutm;
coutn;
cout
7/30/2019 Vivek's Assignment
2/19
cin>>a[i][j];
}
}
cout
7/30/2019 Vivek's Assignment
3/19
{
for(j=0;j
7/30/2019 Vivek's Assignment
4/19
cout
7/30/2019 Vivek's Assignment
5/19
char type_acc[22];
int bal;
public:
void accept()
{
coutacc_no;
coutname;
couttype_acc;
coutbal;
}
void disp()
{
cout
7/30/2019 Vivek's Assignment
6/19
coutx;
bal=bal+x;
}
}
void withdraw(float ac_no)
{
if(acc_no==ac_no)
{
int x;
coutx;
if(bal
7/30/2019 Vivek's Assignment
7/19
do
{
cout
7/30/2019 Vivek's Assignment
8/19
case 4: cout>ac_no;
for(i=0;i
7/30/2019 Vivek's Assignment
9/19
else
cout
7/30/2019 Vivek's Assignment
10/19
Ans:
#include
#include
#include
class account
{
public:
char cust_name[10];
int accno;
int typeofac;
void getaccount()
{
coutcust_name;
cout
7/30/2019 Vivek's Assignment
11/19
cout
7/30/2019 Vivek's Assignment
12/19
{
case 1:
depositamt();
break;
case 2:
withdrawal();
break;
case 3:
calculateinterest();
break;
case 4:
showbalance();
break;
case 5:
exit(0);
}
}while(i!=5);
}
void depositamt()
{
cout
7/30/2019 Vivek's Assignment
13/19
}
void calculateinterest()
{
interest = balance * 0.10;
cout
7/30/2019 Vivek's Assignment
14/19
int i;
do{
cout
7/30/2019 Vivek's Assignment
15/19
{
cout
7/30/2019 Vivek's Assignment
16/19
};
void main()
{
clrscr();
savings s;
s.getaccount();
cout
7/30/2019 Vivek's Assignment
17/19
struct data
{
char state[10];
int eng_col;
int med_col;
int mang_col;
int total;
};
void main()
{
struct data r[3];
int i,hc=0,x=0;
clrscr();
for(i=0;i
7/30/2019 Vivek's Assignment
18/19
if (r[i].total>hc)
{
hc=r[i].total;
x=i;
}
}
else
{
hc=r[i].total;
x=i;
}
}
cout
7/30/2019 Vivek's Assignment
19/19
#include
Power(double m, int n=2)
{
Return = power(m, n);
}
Void main()
{
Coutm>>n;
Power(m,n);
}