Recent content by burton95

  1. B

    Comp Sci C++ Error in function call that I don't understand

    Thanks Anchovy. The increments i and if loop continues running until you drop out of the for loop or a[i] > a[i+1]. I got my original code to work correctly, I used braces for the body of the if loop, but got all out of wack/confused when I tried his code.
  2. B

    Comp Sci C++ Error in function call that I don't understand

    Thank you AlephZero and jbunn. Ok, not to sound defensive but the body of function was cut and pasted from the answer in the book. I actually had different code and was trying to understand why they used the code they did. The question directly from the book: Write a fxn named out of order...
  3. B

    Comp Sci C++ Error in function call that I don't understand

    I must admit I don't understand why the book answer has in the for loop i < size - 1 rather that just size. If I have an array of five spaces I need the loop to execute i 0 through 4. a[0] = 2 a[1] = 7 a[2] = 9 a[3] = 8 a[4] = 12 1st loop Step 1: i = 0 so Step 2: check that i < size(5) - 1...
  4. B

    Comp Sci C++ Error in function call that I don't understand

    #include <iostream> using namespace std; int out_of_order(int a[], int size); const int amount_of_numbers = 5; int main() { int numbers; int a[] = { 2, 7, 9, 8, 12 }; int number_out_of_order = out_of_order(a, amount_of_numbers); cout << number_out_of_order; } int...
  5. B

    Comp Sci C++ Error in function call that I don't understand

    Whoops. If a mod needs to move this to HW CS section I apolgize
  6. B

    Comp Sci C++ Error in function call that I don't understand

    Thanks. amount_of_numbers = 5 at the top. Problem: As my current array is arranged 7 > 6 and therefore 6 should be shown on the screen but I keep getting -1. My original idea was to build this as the answer in the book was given for (int i = 0; i < size - 1; i++) if (a[i] > a[i + 1])...
  7. B

    Comp Sci C++ Error in function call that I don't understand

    Hi there- I'm trying to check an array for ascending order and if not to print out the number that is out of order by using a function. I solved it by not using a function but when I've tried to use a fxn for some reason it tells me that in my call for the fxn the numbers "argument of type int...
  8. B

    C/C++ C++; How to read-in a unknown amount of numbers from an external file

    Hey thanks. I got it with your help. Sorry it took so long to get back to you.
  9. B

    C/C++ C++; How to read-in a unknown amount of numbers from an external file

    Basically I want to take an unknown amount of variables and sum them up. I'm sure it's simple. I know there is some way to tell VS to keep reading the opened stream from my numbers.txt file. #include <iostream> #include <fstream> using namespace std; ifstream data_input...
  10. B

    C/C++ C++. Celsius to Fahren. conver; What temp R they = ?

    The return value is correct, -40. I have a feeling getting loops to run the correct amount of times is going to be tricky topic for me for a while. Thanks to both of you.
  11. B

    C/C++ C++. Celsius to Fahren. conver; What temp R they = ?

    Thanks DH. It says to use int's so that is what I'm doing. Seems pretty obvious now.
  12. B

    C/C++ C++. Celsius to Fahren. conver; What temp R they = ?

    Oh and berkman asked if I could add code tags. Its he referencing code tags in the body of the post or as a tag for the post?
  13. B

    C/C++ C++. Celsius to Fahren. conver; What temp R they = ?

    thanks cpscdave, I added your print line code and obviously it doesn't stop @ -40. I don't get it. c_temp: -34 vs f_temp: -29 c_temp: -35 vs f_temp: -31 c_temp: -36 vs f_temp: -32 c_temp: -37 vs f_temp: -34 c_temp: -38 vs f_temp: -36 c_temp: -39 vs f_temp: -38 c_temp: -40 vs f_temp: -40...
  14. B

    C/C++ C++. Celsius to Fahren. conver; What temp R they = ?

    I must write a program that finds the temperature, as an integer, that is the same in both Celsius and Fahrenheit. The formula for this is F=(9/5)C+32 The program should create two integer variables for the temperature in Celsius and Fahrenheit. Initialize the temperature to 100 degrees...
  15. B

    What is the speed of the m1 piece after the explosion?

    Nevermind i got it. I was setting up v2 for the wrong equation. Thx
Back
Top