I am a beginning programming student.
Here I have written a simple "sum of two numbers" program in Xcode using C++.
//preprocessor directive
#include <stdio.h>
//local declarations
int main (void)
{
//declare variables
int n1, n2, sum;
//input prompts
printf("This program finds the sum of two numbers. Enter your first number.\n");
scanf("%d" , &n1);
printf("Enter another number.\n");
scanf("%d" , &n2);
//process
sum=n1+n2;
//output
printf("The sum is %d." , sum);
return 0;
}
As far as I can tell, my syntax is accurate, however, when I try to build the program, I get this error code:
"Apple Mach-O Linker (Id) Error. Linker command failed with exit code 1 (use -v to see invocation)"
I have been unable to solve this by reading other Q's and A's.
Any proposed solution? It would be greatly appreciated!!