## Address Visited Program – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ int j=0; int temp=0; int temp1=0; int arr[5]={1,2,3,4,5}; for(int i=0;i<5;i++){ cout<<“Value=”<<arr[i]<<” Home address “<<&arr[i]; cout<<endl;} for(j=1;j<6;j++){ if(j==1){ temp1=arr[0]; for(int i=0;i<5;i++){ temp=arr[i]; if(i!=4){ arr[i]=arr[i+1];} if(i==4){ arr[4]=temp1; } } for(int i=0;i<5;i++){ cout<<“Value=”<<arr[0]<<” address visited “<<&arr[i]; cout<<endl;} cout<<endl; for(int i=0;i<5;i++){ cout<<“Value=”<<arr[1]<<” address visited “<<&arr[i]; cout<<endl;} cout<<endl; for(int i=0;i<5;i++){ cout<<“Value=”<<arr[2]<<” address visited “<<&arr[i]; […]

## Student Info using Class – Algorithms & Data Structures in C++

#include<iostream> using namespace std; class student{ public: string c[4]; float percentage[4]; int range; void setstudentinfo(){ cout<<“enter number of student whose record you want to save \n”; cin>>range; for(int k=0;k<range;k++){ cout<<“\n enter name and regno”<<k+1; cin>>c[k];} for(int k=0;k<range;k++){ cout<<“\n enter percentage of student”<<k+1; cin>>percentage[k]; } } void getstudentinfo(){ for(int k=0;k<range;k++){ cout<<“\nstudent is\n”<<k+1<<“regno and name is\n”<<c[k]; if(percentage[k]>=70){ […]

## Pointers Example 7 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ int arr[4]={10,20,30,40}; getaverage(arr,4); float getaverage(int*arr,int size){ } return 0; }

## Pointers Example 6 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ float percentage[40]; int number=0; int *ptrtoarray; cin>>number; ptrtoarray=new int[number]; return 0; }

## Pointers Example 5 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ int*ptr; int**pptr; int number=5; ptr=&number; pptr=&ptr; cout<<*ptr<<**pptr; return 0; }

## Pointers Example 4 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ char array[3]={‘a’,’b’,’v’}; char*aptr; aptr=array; cout<<aptr; return 0; }

## Pointers Example 3 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ int array[3]={10,11,12}; int *aptr; aptr=array; for(int i=0;i<3;i++){ cout<<*aptr+i<<endl; } return 0; }

## Pointers Example 2 – Algorithms & Data Structures in C++

#include<iostream> using namespace std; int main(){ int number=10; int *aptr; aptr=&number; cout<<aptr <<“:”<<*aptr; return 0; }