I'm having a problem with gcd. I don't know why it gives me a red squiggly under the gcd(lower case) at this line
GCD = gcd(y, x % y);
Any help?
Code:
// Greatest Common Divisor.cpp : Defines the entry point for the console application.
//
// =========
// Libraries
// ==================
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <stdio.h>
// ==================
// ==========
// Namespaces
// ====================
using namespace std;
// ====================
// ===================
// Function Prototypes
// =====================
void WelcomeBanner();
void GetIntegers(int&, int&);
// =====================
// ==============
int main( ) { // main()
int x;
int y;
int GCD;
WelcomeBanner();
GetIntegers(x, y);
if (y == 0 ){
cout << "GCD = " << x << endl;
}
else
GCD = gcd(y, x % y);
cout << "GCD = " << GCD << endl;
return 0;
}// main()
// ========
// =========================
// Function WelcomeBanner()
// =========================
void WelcomeBanner(){
cout << "================================================" << endl;
cout << "Welcome to my program that will give you the |" << endl << "greatest common divisor of your two numbers =) |" << endl;
cout << "================================================"<< endl << endl;
}// Welcome banner
// ==================
// ====================
// Function GetIntegers
// ====================
void GetIntegers(int& num1, int& num2){
cout << "Please enter an integer that you want me to find the GCD of." << endl;
cin >> num1;
cout << "Please enter another integer that you want me to find the GCD of." << endl;
cin >> num2;
}//GetIntegers
// ==============