Will pay 50.00 if you can write a quick code for me

Hey guys, i'm in an intro to c++ class, I have a code that's due wednesday, but I have a test wednesday. So I can either write this code, or devote the time to studying....Well I need to study and don't have time to write the code.

basically, the code needs to compute the minimum, maximum, and average of 4 values.....From a separate file using a class and an array!

Thing is, I need this done pretty much immediately! This is just going to be printed and turned in on paper, so what it's actually written in is somewhat irrelevant, it just needs to work!

I can write this code without using a class to access the separate file in probably 20 minutes, and i'm new to c++, so I think this would be a quick 50 dollars if you know how to do it!

email me at mystic97z@charter.net if you're interested!
I have a way that you can be certain to be paid...Basically I run a business and you'd know exactly who I was, and would have access to my business' Facebook page, and I wouldn't even have the option to not pay, because my business runs on my reputation. I'm a 30 year old who returned to school, what i'm trying to say is, don't think for a second that you won't be paid!
Last edited on
does "using a class" mean that you have to make a class?
std::ifstream is a class provided from the standard C++ library.

for calculating min and max you can use the algorithm header in C++ standard library.
Note: min_element and max_element return a forward_iterator to the element so to print the value you need to dereference the value (thats why the asterix is there)

To calculate the average std::accumulate in header numeric would do the trick.
Note, the 0 in accumulate is the offset or start value.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <fstream>
#include <algorithm>
#include <numeric>

int main()
{
    int arr[4];
    
    std::ifstream file("test.txt");
    for(int i = 0; i < 4; ++i)
        file >> arr[i];
        
    std::cout << "min: " << *std::min_element(arr, arr+4)<< std::endl;
    std::cout << "min: " << *std::max_element(arr, arr+4) << std::endl;
    std::cout << "avg: " << std::accumulate(arr,arr+4,0) / 4.0 << std::endl;
}


Last edited on
can i ask you the reason whyd you returned to school?

anways we dont do assignments here.
Topic archived. No new replies allowed.