在C ++中找到盈亏平衡点的程序

#include <iostream>
#include <math.h>
using namespace std;
//calculating Break Even point
int breakEvenPoint(int exp, int S, int M) {
   float earn = S - M;
   int res = ceil(exp / earn);
   return res;
}
int main() {
   int exp = 3550, S = 90, M = 65;
   cout << breakEvenPoint(exp, S, M);
   return 0;
}

输出结果

142