1. write a C++ program that adds the numbers should be void, and takes a third, pass by reference parameter,then puts the sum in that.
2. write a program that asks a name say hello, use your own function that recives a string of characters (name) and print on screen the hello message.(doesn't return anything void type)​

Respuesta :

The C++ programs are illustrations of functions and function reference by parameter

What are functions?

Functions are collections of program statements that are executed when called or evoked

How to pass value to a function by reference parameter

To pass value to a function by reference parameter, we make use of the &variable in the function parameters

The C++ program by reference parameter

The program written in C++ where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

//This defines the function

void addNums(int &x, int &y) {

   //This adds the two numbers

   int sum = x + y;

   //This saves the sum of the two numbers in the first number

   x = z;

}

//Ths main module begins here

int main() {

   //This declares the two numbers

   int firstNum, secondNum;

   //This gets input for the two numbers

   cin>>firstNum;    cin>>secondNum;

   //This calls the addNums function

   addNums(firstNum, secondNum);

   //This prints the sum

   cout << firstNum;

 return 0;

}

The name program

The program written in C++ where comments are used to explain each action is as follows:

#include <iostream>

using namespace std;

//This defines the function

void printName(string name) {

   //This prints the name

   cout<<"Hello "<<name;

}

//Ths main module begins here

int main() {

   //This declares the name

   string name;

   //This gets input for the name

   cin>>name;

   //This calls the printName function

   printName(name);

 return 0;

}

Read more about C++ programs at:

https://brainly.com/question/24833629

ACCESS MORE