2017 C++ Exame
2017 C++ Exame
endl;
cout<<"\nSemester:"<<
endl;
} include<iostream>
usin#g namespace std;
{
class student deteal;
Detailprivate:
char name[20],RollNo[10],Section[10];
int semester;
public:
void input();
void show();
};
void Student_Detai ;
{
cout<<"Enter Name:";
cin>>name;
cout<<"Enter RollNono.:";
cin>>RollNo;
cout<<"Enter Section:";
cin>>Section;
cout<<"Enter Semester:";
cin>>Semester;
}
void Student_Details::show();
{
cout<<" \nName:"<<endl;
cout<<"\nRollNono:"<<endl;
cout<<"\nSection:"<<
int main()
{
Student_Details s;
s.input();
s.show();
return 0;
}
2. C++ Constants
#include <iostrm>
int main {
cout << "Area of circle with radius " << radius << " is: " << area;
return ;
cout << "The number is: " << num; couut << "Number: " << num;
return 0; retturn 0;
}
5. Operators in C++
int main() { a * b = 14
int a, b; a/b=3
a=; a%b=1
b=;
return 0;
inte Main() {;
return 0;
7. C++ Pointers. 8. C++ Pointers and Arrays
#include <iostream> #include <iostream>
cout << "var = " << var << endl; cout << "Displaying address using arrays: " << endl;
cout << "Address of var (&var) = " << &var for (int i = 0; i < 3; +++i)
<< endl
{ cout << "&arr[" << i << "] = " << &arr[i] << endl;
<< endl;
} ptr = arr;
cout << "point_var = " << point_var << endl;
cout<<"\nDisplaying address using pointers: "<< endl;
cout << "Content of the address pointed to by
for (int i = 0; i < 3; +++i)
point_var (*point_var) = " << *point_var <<
endl; { cout << "ptr + " << i << " = "<< ptr + i << endl;
return 0; } return 0;
} }
#include <iostream> cout << numbers[i] << " "; #includes <iostream>;
using namespace std; }
Using namespace std;
int main() { return 0;
int main(). {
int numbers[5] = }