Thread: Am stuck, need an expert?

  1. #16
    Registered User
    Join Date
    Dec 2017
    Posts
    928
    Quote Originally Posted by solidusMGS View Post
    No, I don't understand the question.
    OK. I don't have the time to teach you basic math.
    If you want the truth to stand clear before you, never be for or against. - Sent-ts'an

  2. #17
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by john.c View Post
    OK. I don't have the time to teach you basic math.
    I mean I do understand basic math. Just right now, am very confused about C++ and it is spilling all over. Chaos.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,727
    Quote Originally Posted by solidusMGS
    Just right now, am very confused about C++ and it is spilling all over. Chaos
    Then pause your assignments. Go back to your earlier learning material and figure out how to write a "hello world" program in C++. Do that first, then figure out how to write a C++ program that can read a number from the user and print that same number on screen.

    If you cannot write these two programs, then you absolutely cannot do your assignments, so take a step back and figure out how to write these two programs.

    If you can write these two programs, then write another one: a program that reads two numbers from the user, adds the numbers, and prints the result to screen.

    If you can write this third program, then you can do your first assignment by reading more numbers and changing the "add" to the mathenatical formula.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #19
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by laserlight View Post
    Then pause your assignments. Go back to your earlier learning material and figure out how to write a "hello world" program in C++. Do that first, then figure out how to write a C++ program that can read a number from the user and print that same number on screen.

    If you cannot write these two programs, then you absolutely cannot do your assignments, so take a step back and figure out how to write these two programs.

    If you can write these two programs, then write another one: a program that reads two numbers from the user, adds the numbers, and prints the result to screen.

    If you can write this third program, then you can do your first assignment by reading more numbers and changing the "add" to the mathenatical formula.
    I was able to do that. But I used int instead of double. Is double and int the same thing?

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,727
    No, your learning material should have a section on data types that explains this.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Ok. What is also making me freak out is that how do I enter my saved C++ files and put them on ares? That is just boggling my mind!

    Quote Originally Posted by laserlight View Post
    No, your learning material should have a section on data types that explains this.

  7. #22
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,750
    Quote Originally Posted by solidusMGS View Post
    Ok. What is also making me freak out is that how do I enter my saved C++ files and put them on ares? That is just boggling my mind!
    Put them on.. ares? What's ares?

  8. #23
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by Hodor View Post
    Put them on.. ares? What's ares?
    From the way he explained it it appears to be a unix machine.

  9. #24
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,750
    Quote Originally Posted by solidusMGS View Post
    From the way he explained it it appears to be a unix machine.
    And how are we supposed to help if you don't even know what it (ARES) is? Even ignoring that, why do you have a "professor" teaching mathematics that would be more appropriate for an 11 or 12 year old? If you're truly at university level and a professor truly assigned this task then the state of education in whatever country you're in is truly sad. Is your "professor" qualified?

    Edit: what I'm saying is that this is not a university level problem. I'm saying that it's the kind of problem that an 11 or 12 year old should be able to solve (I don't know what country you're in so I don't know how your school structure is set up, but it's a problem suitable for early highschool, not university. So, what country are you from? Are "professors" in your country actually qualified?)
    Last edited by Hodor; 01-26-2020 at 05:57 AM.

  10. #25
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by Hodor View Post
    And how are we supposed to help if you don't even know what it (ARES) is? Even ignoring that, why do you have a "professor" teaching mathematics that would be more appropriate for an 11 or 12 year old? If you're truly at university level and a professor truly assigned this task then the state of education in whatever country you're in is truly sad. Is your "professor" qualified?

    Edit: what I'm saying is that this is not a university level problem. I'm saying that it's the kind of problem that an 11 or 12 year old should be able to solve (I don't know what country you're in so I don't know how your school structure is set up, but it's a problem suitable for early highschool, not university. So, what country are you from? Are "professors" in your country actually qualified?)
    Hey, I can solve it when I right it down. I can't write it in code that is what is causing me the problem.

    EDIT: Obviously, I misspelled "write".

  11. #26
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    830
    Quote Originally Posted by solidusMGS View Post
    Quote Originally Posted by laserlight View Post
    ()
    If you can write this third program, then you can do your first assignment by reading more numbers and changing the "add" to the mathenatical formula.
    I was able to do that. But I used int instead of double. Is double and int the same thing?
    Post your current code, even if incomplete. No point switching topics before you got that right. After that you can worry about "ares" & Co.

  12. #27
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by -Adrian View Post
    Post your current code, even if incomplete. No point switching topics before you got that right. After that you can worry about "ares" & Co.
    Code for "Hello world"

    Code:
    #include <iostream>using namespace std;
    int main()
    {
        cout << "Hi Taco!";
        return 0;
    }

    Add/sub number code

    Code:
    #include <iostream>using namespace std;
    int main()
    {
        int firstNumber, secondNumber, sumOfTwoNumbers;
    
    
        cout << "Enter two integers: ";
        cin >> firstNumber >> secondNumber;
       
        sumOfTwoNumbers = firstNumber + secondNumber;
        // Prints sum
        cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers;
        return 0;
    }
    For the second one, why can't I put double for int? I am using codeblocks...

    Also, where would I put the equation to make it work?
    Last edited by solidusMGS; 01-28-2020 at 10:04 AM.

  13. #28
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,971
    Nothing wrong with that.
    Code:
    $ cat foo.cpp && g++ foo.cpp
    #include <iostream>
    using namespace std;
    int main()
    {
        int firstNumber, secondNumber, sumOfTwoNumbers;
     
     
        cout << "Enter two integers: ";
        cin >> firstNumber >> secondNumber;
        
        sumOfTwoNumbers = firstNumber + secondNumber;
        // Prints sum
        cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers << endl;
        return 0;
    }
    $ ./a.out 
    Enter two integers: 22 33
    22 + 33 = 55
    Changing int to double is trivial.
    Code:
    $ cat foo.cpp && g++ foo.cpp
    #include <iostream>
    using namespace std;
    int main()
    {
        double firstNumber, secondNumber, sumOfTwoNumbers;
     
     
        cout << "Enter two integers: ";
        cin >> firstNumber >> secondNumber;
        
        sumOfTwoNumbers = firstNumber + secondNumber;
        // Prints sum
        cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers << endl;
        return 0;
    }
    $ ./a.out 
    Enter two integers: 22 33
    22 + 33 = 55
    $ ./a.out 
    Enter two integers: 22.22 33.33
    22.22 + 33.33 = 55.55
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  14. #29
    Registered User
    Join Date
    Dec 2019
    Posts
    46
    Quote Originally Posted by Salem View Post
    Nothing wrong with that.
    Code:
    $ cat foo.cpp && g++ foo.cpp
    #include <iostream>
    using namespace std;
    int main()
    {
        int firstNumber, secondNumber, sumOfTwoNumbers;
     
     
        cout << "Enter two integers: ";
        cin >> firstNumber >> secondNumber;
        
        sumOfTwoNumbers = firstNumber + secondNumber;
        // Prints sum
        cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers << endl;
        return 0;
    }
    $ ./a.out 
    Enter two integers: 22 33
    22 + 33 = 55
    Changing int to double is trivial.
    Code:
    $ cat foo.cpp && g++ foo.cpp
    #include <iostream>
    using namespace std;
    int main()
    {
        double firstNumber, secondNumber, sumOfTwoNumbers;
     
     
        cout << "Enter two integers: ";
        cin >> firstNumber >> secondNumber;
        
        sumOfTwoNumbers = firstNumber + secondNumber;
        // Prints sum
        cout << firstNumber << " + " <<  secondNumber << " = " << sumOfTwoNumbers << endl;
        return 0;
    }
    $ ./a.out 
    Enter two integers: 22 33
    22 + 33 = 55
    $ ./a.out 
    Enter two integers: 22.22 33.33
    22.22 + 33.33 = 55.55
    Thanks.

    Uh, how do you use pow? Can it be written as sumoftwonumbers= pow(4.0,3.0)?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i need a c expert..
    By riel in forum C Programming
    Replies: 7
    Last Post: 01-27-2008, 07:19 AM
  2. need some expert help here!
    By magix24 in forum C Programming
    Replies: 1
    Last Post: 04-11-2006, 10:36 PM
  3. the ask an expert is down!?
    By fmchrist in forum C Programming
    Replies: 3
    Last Post: 12-29-2005, 04:19 PM
  4. c++ expert
    By febrian81 in forum C++ Programming
    Replies: 2
    Last Post: 07-01-2002, 10:27 PM

Tags for this Thread