Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

I have an Excel formula which I'm trying to write as a loop in C++. The formula starts off with the first cell being 0, then the next cell being: =MAX((N2-O2-P2)/B21,0). Any ideas?

OpenStudy (anonymous):

Assuming N2, 02, P2 and B21 are values you know to retrieve yourself in C++ somehow (without more info in what they're supposed to be can't say much there) then something like: #include <iostream> #include <algorithm> using namespace std; int main() { //for however many cells you want to run for for(int i = 0; i < numberOfCellsYouWantToRunFor; i++) { //assuming ints int N2 = getFunctionForN2(); int O2 = getFunctionForO2(); int P2 = getFunctionForP2(); int B21 = getFunctionForB21(); cout << max(((float) N2-O2-P2)/(float) B21), 0) << endl; } return 0; } Hope that helps. My C++ syntax might be a little rusty.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Breathless: Spooky witch but cute
4 hours ago 3 Replies 0 Medals
Arriyanalol: help
4 hours ago 10 Replies 2 Medals
Arriyanalol: @tinydinoUwU stop trying to find a argument u blad lil boy
1 day ago 5 Replies 4 Medals
Jaded012023: Please tell me what you all think of this song
7 hours ago 6 Replies 1 Medal
Arriyanalol: bro how
7 hours ago 2 Replies 3 Medals
Arriyanalol: cant wait for the new bluey movie in 2027
1 day ago 12 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!