-
July 19th, 2013, 11:27 PM
#1
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.
-
July 20th, 2013, 12:05 AM
#2
Re: need help in C++ question?
-
July 20th, 2013, 02:49 AM
#3
Re: need help in C++ question?
Originally Posted by s_zar
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.
-
July 20th, 2013, 05:30 AM
#4
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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 20th, 2013, 02:30 PM
#5
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.
-
July 20th, 2013, 03:00 PM
#6
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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|