I got error messages saying that: error LNK2019: unresolved external symbol \"vo
ID: 3540006 • Letter: I
Question
I got error messages saying that:
error LNK2019: unresolved external symbol "void __cdecl getYogurtFlavors(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?getYogurtFlavors@@YAXAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z) referenced in function _main
LNK2019: unresolved external symbol "bool __cdecl addAnotherOrderQ(void)" (?addAnotherOrderQ@@YA_NXZ) referenced in function _main
I really don't know what to do. Need someone to modify my codes!
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void printWelcomeMessage();
double getYogurtSize(string& yogurtSize);
void getYogurtFlavors(string& flavor1, string& flavor2, string& flavor3);
void printOrder(const string& yogurtSize, const string& flavor1, const string& flavor2, const string& flavor3, int orderNumber);
bool addAnotherOrderQ();
void printTotalCosts(double subtotal);
// This is the main function.
int main(){
// initialize the loop variables
bool repeat = 1;
int orderNumber =1 ;
// Variables for size and flavors. By default they are initilized to "".
string yogurtSize;
string flavor1, flavor2, flavor3;
// Variable for cost
double subtotal = 0;
// Print the welcome message
printWelcomeMessage();
// Continue to get orders until the user is done
do{
// Update the size and subtotal
subtotal = subtotal + getYogurtSize(yogurtSize);
// Update the flavors
getYogurtFlavors(flavor1, flavor2, flavor3);
//Print the current order
printOrder(yogurtSize, flavor1, flavor2, flavor3, orderNumber);
// Determine whether or not to keep repeating.
repeat = addAnotherOrderQ();
// Increment order number
++orderNumber;
}while(repeat == 1);
// Print out the subtotal, tax and total
printTotalCosts(subtotal);
// Tell the function to stop
return 0;
}
void printWelcomeMessage(){
cout<<"Welcome to My Frozen Yogurt! ";
}
double getYogurtSize(string& yogurtSize){
cout<<"What size would you like? ";
cout<<"Please enter small, medium, or large: ";
cin>>yogurtSize;
if(yogurtSize=="small"){
const double SMALL=2.19;
return SMALL;
}
else if(yogurtSize=="medium"){
const double MEDIUM=3.49;
return MEDIUM;
}
else{
const double LARGE=4.49;
return LARGE;
}
}
void printYogurtFlavors(string& flavor1, string& flavor2, string& flavor3){
cout<<" ";
cout<<"Enter flavor 1: ";
getline(cin, flavor1);
cout<<"Enter flavor 2: ";
getline(cin, flavor2);
if(flavor2=="DONE"){
cout<<" ";
}
else{
cout<<"Enter Flavor 3: ";
getline(cin, flavor3);
cout<<" ";
}
}
void printOrder(const string& yogurtSize, const string& flavor1, const string& flavor2, const string& flavor3, int orderNumber){
if(flavor2=="DONE"){
cout<<"** Order "<<orderNumber<<": "<<yogurtSize+" "+flavor1.substr(0,4)<<" **"<<endl;
}
if(flavor3=="DONE"){
cout<<"** Order "<<orderNumber<<": "<<yogurtSize+" "+flavor1.substr(0,4)+"-"+flavor2.substr(0,4)<<" **"<<endl;
}
else{
cout<<"** Order "<<orderNumber<<": "<<yogurtSize+" "+flavor1.substr(0,4)+"-"+flavor2.substr(0,4)+"-"+flavor3.substr(0,4)<<" **"<<endl;
}
cout<<" ";
}
bool addAnotherQ(){
string choice;
cout<<"Would you like to add another order? ";
cout<<"Please enter yes or no: ";
getline(cin,choice);
if(choice=="yes"){
return true;
}
else{
return false;
}
}
void printTotalCosts(double subtotal){
cout<<"Subtotal: "<<subtotal<<endl;
double tax = subtotal*0.0875;
cout<<"Tax(8.75%: "<<fixed<<setprecision(2)<<tax<<endl;
cout<<"Total: "<<subtotal+tax<<endl;
cout<<" ";
}
Explanation / Answer
i am not seeing functions ?? getYogurtFlavors(). addAnotherOrderQ(). please include them then u wil get no compilation error.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.