Answer to Question #208911 in C++ for Ahmed Ali

Question #208911
  • Write a program that declares an integer in main() functions. One function inputs a value in the variable defined in the main() function. The second function doubles the value of that variable
1
Expert's answer
2021-06-20T08:11:35-0400
#include <iostream>
using namespace std;
void input(int &x){
    cout<<"Input the value of the variable: ";
    cin>>x;
}
void doubles(int &x){
    x *= x;
}
int main(){
    int x;
    input(x);
    cout<<"Value of x: "<<x<<endl;
    doubles(x);
    cout<<"Value of x: "<<x<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Adil Sarfraz
03.07.21, 07:29

Good

Abdul Rehman
03.07.21, 07:28

output please

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS