0

/* I'm new on c ++ and i been strugling with this problem.
create the special functions used by this routine and
write the functions so it can be used by the main routine as shown*/


#include <stdio.h>
#include <stdlib.h>

void divideArgs(&parmA, &parmB);
{
int temp = *parmA;
*parmA = *parmB;
*parmB = temp;
}

/* MAIN */
int main(int argc, char **argv) {
if (argc != 3) {
printf("?Invalid number of arguments\n");
system("pause");
exit(1);
}
int parmA = atoi(argv[1]);
int parmB = atoi(argv[2]);

/* Divide parmA by parmB. Put the quotient in parmA, remainder in parmB */
/* Reset the original values after we print the result */
printf("Quotient of %d / %d is ",parmA,parmB);
// divideArgs(&parmA, &parmB);
printf("%d, remainder is %d\n",parmA,parmB);
parmA = atoi(argv[1]);
parmB = atoi(argv[2]);


}
printf("\n");

system("pause");
exit(0);
}

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by zhelih
0

Maybe you should set a type to parmA & parmB:

void divideArgs(int *parmA, int *parmB){
int temp = *parmA;
*parmA = *parmB;
*parmB = temp;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.