Itp Assignment 4
Itp Assignment 4
REG# BSE183137
ASSIGNMENT#4
Question#2
#include<iostream>
void swap(int&x,int&y)
int temp;
temp=x;
x=y;
y=temp;
int main()
int a,b;
cin>>a;
cin>>b;
swap(a,b);
cout<<"After swapping"<<endl;
cout<<"a="<<a;
cout<<"b="<<b;
system("pause");
return 0;
Question1
#include<iostream>
void intro()
char name[10],address[20],degree[10],sto;
cin.getline(name,10,'*');
cin.getline(address,20,'@');
cin.getline(degree,10,'£');
cout<<"name of student"<<name<<endl;
cout<<"address of student"<<address<<endl;
cout<<"degree of student"<<degree<<endl;
int main()
intro();
system("pause");
Question 3
#include<iostream>
int main()
int a[5]={56,67,78,89,99};
system("pause");
float q=0.0;
if(marks[s]>90)
q=q+(3*4.0);
q=q+(3*3.7);
q=q+(3*3.3);
q=q+(3*3.0);
}
q=q+(3*2.7);
q=q+(3*2.3);
q=q+(3*2.0);
q=q+(3*1.7);
q=q+(3*1.3);
q=q+(3*1.0);
{
q=q+(3*0.7);
else
q=q+0.0;
q=q/15;
return q;
system("pause");
Question2
#include<iostream>
int main()
int size=20;
char arr[20];
cin.getline(arr,20,'#');
cout<<endl;
system("pause");
return 0;
int count=0;
for (int i=0;i<size;i++)
char ch=(array[i]);
count++;
return count;