I have a question for you

Asked 2 years ago, Updated 2 years ago, 21 views

Number one.

 int main(){
      int a =10, b =3, c, d;
      div( a, b, &c, &d);
      cout<<" share ="<<c<<" rest ="<d<<<endl;"
      return 0;
   }

Output>> Quotation = 3 Remaining = 1

Number two.

   int main(){
      int a =10, b =3, c, d;
      div( a, b, c, d);
      cout<<" share ="<<c<<" rest ="<d<<<endl;"
      return 0;
   }

Output Quotation = 3 Remaining = 1

Source code, the difference between the two is the difference between div(a,b,c,d); and &. How do I make a division (output result) using the source code above?

c++

2022-09-20 10:54

1 Answers

The first is to create a div function using pointer variables, and the second is to create a div function using reference variables in C++ languages.

The pointer variable is a variable in the form of int* x and the reference variable is a variable in the form of int&x. Note that the pointer variable is in both C and C++ languages, and the reference variable is in C++ languages only and not in C languages.


2022-09-20 10:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.