Answer to Question #145426 in C++ for chichi

Question #145426
Write a program in C++ to add the given two numbers using pointers.
1
Expert's answer
2020-11-20T10:11:07-0500
#include <iostream>
using namespace std;

int main()
{
int f,s,*p,*q,sum;
cout<<"Enter two integers to add\n";
cin>>f>>s;
p= &f;
q=&s;
sum= *p + *q;
cout<<"Sum of two numbers = "<< sum;
   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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog