Я новичок в C ++ и функции,
Я получаю сообщение об ошибке "команда компоновщика завершилась неудачно с кодом выхода 1", интересно, кто-нибудь может дать мне некоторое представление о том, как решить эту проблему, и о моей общей организации кода. Большое спасибо за ваше время и мнение по этому вопросу :)
игнорировать приведенное ниже утверждение
(из-за недостатка места мне пришлось удалить операторы #include, в которые входили следующие iostream, iomanip, string и cmath).
#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
void header();
double number();
int menu();
void seeMenu();
void processChoice();
void negPos();
int squareRoot();
void evenOdd();
void numOfDigits();
void digitAtPos();
using namespace std;
int main()
{
int choice = 0;
header();
number();
menu();
seeMenu();
processChoice();
while (choice != 0) {
processChoice();}
return 0;
}
void header(){
cout << "Number Manipulator"<< endl; }
double number() {
double num;
cout << "Enter a number to continue: ";
cin >> num;
return num; }
int menu(){
cout << "\nHere are your choices:";
cout << endl << setw(29) << "1) Is it even or odd?";
cout << endl << setw(38) << "2) Is it positive or negative?";
cout << endl << setw(49) << "3) What is the square root?";
cout << endl << setw(41) << "4) How many digits in the number?";
cout << endl << setw(54) << "5) What is the digit at a particular location?";
cout << endl << setw(19) << "0) To Quit.";
}
int showMenu() {
int choice;
cout << endl << endl <<"Enter your choice: ";
cin >> choice;
return choice; }
void processChoice(int choice) {
switch (choice) {
case 1: squareRoot();
break;
case 2: evenOdd();
break;
case 3: negPos();
break;
case 4: numOfDigits();
break;
case 5: digitAtPos();
break;
default:
cout << "This is not a valid choice. Please try again!";
showMenu();
break; }}
void negPos(int num) {
if (num > 0) cout << "Number is Positive"<< endl;
if (num < 0) cout << "Number is Negative"<< endl;
if (num == 0) cout << "Number is Zero"<< endl; }
void evenOdd(int num) {
if (num%2 == 0) cout << "Number is even";
else cout << "Number is odd"; }
void squareRoot(int num) {
int numSqrt;
numSqrt=sqrt(num);
cout << "Square root of " << num << " is " << numSqrt; }
void numOfDigits(int num) {
int numDigits=0;
do {
num /= 10;
numDigits++;
} while(num);
cout << "The number of digits in " << num << " is " << numDigits; }
void digitAtPos(int num) {
int pos;
cout << "What Position?: ";
cin >> pos; }
//need to be completed