#include<iostream> using namespace std; void change(int data); int main() { int data=3; change(data); cout<<“value “<<data<<endl; return 0; } void change(int data) { data =5; } OUTPUT
Write a C++ program to represent the function overriding using AVERAGE() function.
#include <iostream> #include <string> using namespace std; int avrg( int , int ); int avrg( int , int, int); float avrg( float, int); int avrg(char, char); int main() { int average; cin >> average; int averageI; cin >> averageI; float x; cin >>x; float y; cin >>y; float averageF = avrg(x,y); char averageC = avrg('x','y');... Continue Reading →
Write a program in C++ to read and write the values in different variables using cascading of >> and <<
#include <bits/stdc++.h> using namespace std; int main(void) { int a; float b; char c; char str[50] ; cin>>a>>b>>c>>str; cout <<“integer – “<<a<<“\n”<<“float – “<<b<<“\n”<<“character- “<<c<<“\n”<<“string- “<<str; return 0; } OUTPUT
Write a C++ program to read and write the values in different types of variables using cin and cout.
#include <iostream> using namespace std; int main() { int i; cout<< "Enter an integer value: "; cin >>i; cout<< "Number entered is"<<i; cout<< " double of the number is"<<i*2<<"\n"; return 0; } OUTPUT