Я понятия не имею, что здесь происходит. Я не получаю никаких ошибок, программа попадает в первую функцию, а затем пропускает, чтобы вернуть 0. Это упражнение, которое я делаю. Пользователь вводит номер в машине соды, а затем получает элемент, который они выбрали. Любая помощь будет принята с благодарностью!Beginner C++ Функция пропущена: ошибок нет
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
void Menu()
{
cout << "===========================" << endl;
cout << "========SODA MACHINE=======" << endl;
cout << "===========================" << endl;
cout << "Pick a soda... " << endl;
cout << "[1] Coca-Cola" << endl;
cout << "[2] Diet Coca-Cola" << endl;
cout << "[3] MUG Root Beer" << endl;
cout << "[4] Sprite" << endl;
}
int processSelection()
{
int selection;
cin >> selection;
cout << "This function was called." << endl;
return selection;
}
void dropSoda()
{
int myselection;
myselection = processSelection();
switch (myselection)
{
case 1:
cout << "Your can of Coca-Cola drops into the bin at the bottom of the machine." << endl;
break;
case 2:
cout << "Your can of Diet Coca-Cola drops into the bin at the bottom of the machine." << endl;
break;
case 3:
cout << "Your can of MUG Root Beer drops into the bin at the bottom of the machine." << endl;
break;
case 4:
cout << "Your can of Sprite drops into the bin at the bottom of the machine." << endl;
break;
default:
cout << "INVALID SELECTION." << endl;
break;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
Menu();
int processSelection();
void dropSoda();
return 0;
}
'INT processSelection();' это объявление функции в главном теле. Какова цель на самом деле? –
Строка 'Menu();' предполагает, что у вас есть некоторое представление о том, как вызывать функции, но вы не смогли применить это знание к двум другим функциям. – molbdnilo