need help in C++ question?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: need help in C++ question?

  1. #1
    Join Date
    Jul 2013
    Posts
    3

    need help in C++ question?

    Write a program in which you create a const whose value is determined at runtime by reading the time when the program starts (hint: use the <ctime> standard header). In a separate function, have the program create two arrays of 10,000 doubles. Initialize the first array with sequential integral values starting with 100, and initialize the second array with the same numbers, but in reverse order (i.e., the first array would contain 100, 101, 102 while the second array contains 10,099, 10,098, 10,097). Loop through both arrays using a single loop, and multiply the corresponding array elements from each array together and display the result. Read the time when the program completes the multiplication, and compute and display the elapsed time. Do not use inline functions in this program.

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,196

    Re: need help in C++ question?

    What help do you need?
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    Join Date
    Apr 1999
    Posts
    27,418

    Re: need help in C++ question?

    Quote Originally Posted by s_zar View Post
    Write a program in which you create a const whose value is determined at runtime by reading the time when the program starts
    And who is going to make me write this function? Is there some brute that's going to beat me up if I don't follow these directions?

    Or is this your homework? If it's your homework, you're supposed to tell us what you're having a problem with instead of posting your homework problem verbatim on a programming forum.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; July 20th, 2013 at 02:51 AM.

  4. #4
    Join Date
    Dec 2012
    Location
    England
    Posts
    1,993

    Re: need help in C++ question?

    We don't write programs. I suggest you read

    http://forums.codeguru.com/showthrea...ork-assignment

    and then come back to us with a question regarding what your problem is, how you have approached it, and where you are stuck. Post the code you have come up with so far, pointing out how it should behave, how it actually does behave, and what you don't understand. The we'll be able to provide you with advice and guidance.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  5. #5
    Join Date
    Jul 2013
    Posts
    3

    Re: need help in C++ question?

    if you guys can tell me how do i start coding. i know its start with <ctime> then make array of a[] and b[] then array range of each array 1 till 10000 then what should i do next.

  6. #6
    Join Date
    Dec 2012
    Location
    England
    Posts
    1,993

    Re: need help in C++ question?

    if you guys can tell me how do i start coding. i know its start with <ctime>
    The program code starts like this

    Code:
    #include <ctime>
    
    int main()
    {
         return 0;
    }
    Now you need to attempt to extend this skeleton code to meet the requirements of the assignment. As I said previosuly, we don't write the code for you.

    You have produced a program design first before you start to code? Then just translate your program design into code. If you post back here what you have produced, we'll provide further comment and guidance.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center