Reputation: 11
I'm new to C++ and working on a function that first prompts the user to enter number of chair, surface area, color of the chair and then prompts the user to enter the type of wood - m for mahogany, o for oak, or p for pine and ideally any other entry should be rejected. After entering the chair color I'm getting "Process finished with exit code 132 (interrupted by signal 4: SIGILL)" instead of prompting the user to select woodtype.
}
} lab1.h
#ifndef LAB1_H
#define LAB1_H
#include <string>
using namespace std;
int takeNumOfChair(int numOfChair);
float takeSurfaceArea(float surfaceArea);
string takeColourOfSeats(string colourOfSeats);
void takeTypeOfWood(char typeOfWood);
Upvotes: 0
Views: 2818
Reputation: 75062
Your program invokes undefined behavior by falling at end of non-void functions without executing return
statement.
You have to add return
statements or change the return types of functions to void
.
Your return type of the function takeTypeOfWood
is already void
, so it seems you should use void
for the return types of the other functions in lab1.h
and lab1.cpp
.
Upvotes: 4