Hello @ member 12805452 it sounds like getTeacherCount should have been returning 0 instead :P (THIS IS A JOKE DON'T DIVIDE BY 0 IN C it can have funny effects depending on your setup.)
The only problem i see with the logic is the return 0 from the calculateResults
I was Taught it is a good idea to prototype above main then put the function definitions below soo i did that here.
#include <iostream>
#include <string>
int getStudentCount();
int getTeacherCount();
int calculateResult(int numStudents, int numTeacher);
void printResults(int classSize);
int main()
{
int numStudents = getStudentCount();
int numTeacher = getTeacherCount();
int classSize = calculateResult(numStudents, numTeacher);
printResults(classSize);
while(1); return 0;}
int getStudentCount()
{
std::cout << "Enter number of students";
int numStudents;
std::cin >> numStudents;
return numStudents;
}
int getTeacherCount()
{
std::cout <<"Enter number of teacher:";
int numTeacher;
std::cin >> numTeacher;
return numTeacher;
}
int calculateResult(int numStudents, int numTeacher)
{
int classSize;
int classSize = numStudents / numTeacher;
cout << classSize; return classSize; }
void printResults(int classSize)
{
std::cout <<"The average is: " << classSize << std::endl;
}
O and like what everyone else was saying, if you have a debugger at your disposal you should master it.