Recent content by odinx

  1. O

    How do you give an error for someone entering a letter

    #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; double sort(double input[], int N) { double temp; int i, j; for (i=0; i<=8; i++) { for (j=i+1; j<=9; j++) { if(input[i]>input[j]) { temp=input[i]...
  2. O

    C/C++ How to make my program switch commands at certain intervals/bounds in c++

    I have a new problem where I have 2 formulas, and I need to tell my program that at certain intervals/parameters/bounds it needs to do one of the formulas and at other intervals it needs to do another one. To be more descriptive When ever my time=0 to time=(T/2) it should do formula 1, and...
  3. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; int main() { double a,b,c,h,v,w,x,y,z,tolerance,series,series1; tolerance=0.01; cout << "Enter the width, W: "; cin >> w; if (w<0) { cout << "Error: The Width must be...
  4. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; int main() { double a,b,c,h,v,w,x,y,z,tolerance,series,series1; tolerance=0.01; cout << "Enter the width, W: "; cin >> w; if (w<0) { cout << "Error: The Width must be...
  5. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    I think I got what you meant. The program works, but the precision and accuracy is still off and I don't know why. Can anyone see where I go wrong? #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; int main() { double...
  6. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    could you please clarify a bit more I'm still kinda lost. Also I feel as if the program is working, but it isn't checking my tolerance value of 0.01/ making sure that the difference of a and be is not more then 0.01 of each other. Because when I run the program I get values, but they're off...
  7. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    I think I got it, but I'm not sure... The only problems I can see is if the compiler get's confused with what is what for my while and if statements. I also set the functions bounds to be constant. #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using...
  8. O

    C/C++ How to Solve Bisection C++ Problem for Calculating Volume

    #include <iostream> #include <cstdlib> #include <cmath> using std::cout; using std::endl; using std::cin; int main() { double h,v,w,z,y; cout << "Enter the width, W: "; cin >> w; if (w<0) { cout << "Error: The Width must be strictly positive." << endl; return EXIT_FAILURE; }...
Back
Top