/**********************************************************************************
DO NOT REMOVE THIS DESCRIPTION FROM THIS COMMENT BLOCK
NO CREDIT IS CONSIDERED WITHOUT THIS COMMENT BLOCK
Program Description
Write a program that finds the basic measures of central tendency of 1000 numbers
stored in a data file. The data file, numbers.txt (see the included file in the
project). Each integer in the file is written on a separate line. Do not modify
the contents of the numbers.txt file
The program should read the contents of the file into an array of size 1000 and
then calculate and display the following data:
--The lowest number in the array
--The highest number in the array
--The total sum of the numbers in the array
--The mean average of the numbers in array
Declare, call and define four functions that find and return each of the values
to variables that represent each measure of central tendency.
It is important that you provided ONLY the content and data that is required.
Extra information and data will result in a grade of no more than 30%
Missing required information will result in a grade of no more than 20%
Make sure to replace yourFirst LastName with your actual names. no credit is
considered without your name\
Here is the expected layout of the program. Your output values may vary.
Loading the data file...
Number Analysis
by
yourFirst LastName
-------------------------
Lowest = 2
Highest = 9383
Total Sum = 8273628
Mean Average = 12893.4536
-------------------------
Press Enter to end program...
*******************************************************************************/
#include <iostream>
#include <fstream>
using namespace std;
int lowestNum(int nums[], int x){
int lowest = 100000;
for(int i = 0; i < x; i++){
if(nums[i] <= lowest)
lowest = nums[i];
return lowest;
}
}
int highestNum(int nums[], int x){
int highest = nums[0];
for(int i = 1; i < x; i++){
if(nums[i] > highest)
highest = nums[i];
return highest;
}
}
int totalSum(int nums[], int x){
int sum = 0;
for(int i = 0; i < x; i++){
sum += nums[i];
return sum;
}
}
double meanAverage(int j){
double mean;
mean = (static_cast<double>(j))/1000;
return mean;
}
int main()
{
int size = 1000;
int lowestNumber;
int highestNumber;
int total;
double average;
int numbers[size];
ifstream inputFile("numbers.txt");
int count = 0;
cout << "Loading the data file...\n";
while(!inputFile.eof())
{
inputFile >> numbers[count];
count++;
}
inputFile.close();
lowestNumber = lowestNum(numbers, size);
highestNumber = highestNum(numbers, size);
total = totalSum(numbers, size);
average = meanAverage(total);
cout << "\n Number Analysis\n";
cout << " by\n";
cout << " Manvir Chakal\n";
cout << "------------------------------\n";
cout << " Lowest = " << lowestNumber << endl;
cout << " Highest = " << highestNumber << endl;
cout << " Total Sum = " << total << endl;
cout << "Mean Average = " << average << endl;
cout << "------------------------------\n";
cout << "Press Enter to end program...";
return 0;
}
9774
7806
4536
2906
7820
5234
8530
4761
694
388
2071
2455
4934
1962
1456
2680
5784
2176
6420
9763
3121
7287
7191
4781
1600
3888
5928
344
6458
8463
1672
2583
2620
2559
5488
440
7792
370
1552
4838
757
3622
3644
2042
5583
5100
4721
7718
3627
7492
7480
3099
4779
1023
4231
2730
4910
158
3073
7719
4972
1096
301
7592
3654
5788
4383
1445
2509
5934
2634
3265
5907
6278
5307
1
7729
6379
5558
7707
3871
9390
7158
5001
412
1388
7730
1673
7898
7154
5743
2869
8249
6043
6812
1902
8182
7546
9698
691
3479
8684
3955
9385
4961
5613
7225
9041
1992
9135
3099
2214
8524
256
7214
5287
1644
1295
3311
9541
8448
9053
8761
3048
5095
1925
1301
9628
9470
7350
318
2949
6033
625
8685
7345
2589
2262
6385
932
1396
9484
3145
6271
9739
358
7909
7734
1652
1219
3626
6451
6623
2387
9498
1717
663
7150
7696
132
4500
8014
9432
532
4990
8117
7877
7578
6730
613
8510
4477
6448
1654
7099
2539
8364
5007
272
15
2577
3898
2818
9199
2636
8667
7267
3298
5817
4962
3429
6668
9327
2861
3551
4316
7329
7779
1894
410
8392
403
4886
1191
8408
8336
3729
6771
9694
4001
3138
8622
4250
5955
4172
6885
4621
1438
182
6789
2751
9962
3456
8430
9174
7007
2745
2854
1137
990
3263
9528
7744
4500
7071
6152
2835
799
9274
8880
4799
2411
7501
9048
8365
1672
2284
9338
9461
8817
6126
8564
8779
5934
6993
7952
9292
6089
806
428
7079
420
6308
1174
4920
3378
3677
4106
4176
2951
9338
5327
5361
6838
726
78
8510
3010
5767
4322
1826
8244
2885
6956
529
6229
4908
9820
2318
2065
6600
5748
8836
9259
3273
107
2636
6950
565
3163
9900
9902
4841
1612
6739
5567
8041
1600
4928
3807
2274
6753
8403
5158
3709
8931
7739
4968
8751
6408
3384
1702
2155
8571
960
1779
8678
9947
8728
9242
3109
8627
5495
4302
6591
2233
9868
4631
185
4795
4790
2458
7899
3192
3967
7959
2122
1705
9278
7224
8112
9013
8925
6618
7584
6236
8397
6261
6182
3476
1854
9291
2103
7348
9944
5045
5932
9811
9675
6116
957
816
4925
5207
4007
8892
9518
2481
6948
8795
9704
1412
7808
4981
4381
5391
1216
9129
8003
7398
2605
6208
3040
1059
3555
2983
6103
5838
9145
5777
8306
6453
2945
3230
1659
6951
8473
7528
9431
1773
6323
5487
9536
4130
467
3916
5872
8034
3045
3874
5431
5649
81
4822
3059
9987
4156
9161
5824
3300
1289
481
9752
4233
63
7763
1184
4887
5290
6966
6659
7964
2452
6194
2093
9270
6462
4316
3656
9506
8189
5438
1506
4621
260
4564
959
4415
76
3135
4067
1364
3615
170
5597
3677
7932
3132
8564
9574
6449
1574
3889
2
4120
2334
874
581
6649
4529
6438
1190
9967
4295
5810
226
5210
3121
992
5285
6255
5058
3000
6221
5228
4948
9898
9511
4431
4813
5436
880
6386
9325
6132
6857
1658
7005
7437
8306
1534
3874
9495
1500
8168
1657
8077
3377
4777
9068
5013
1031
4126
8013
3603
5705
2960
3500
5215
7391
4664
651
4622
7402
9975
753
4258
1632
4109
1695
6289
1994
1920
5784
9845
6440
7440
7921
6168
8568
3341
1181
5950
3818
5545
9552
9522
4856
9404
4736
2246
4067
1738
3219
7820
1712
3971
2078
9695
4432
124
5984
6425
2043
8119
6270
8482
1910
542
4650
477
3882
2182
6426
7699
7726
2329
3572
8933
1732
4660
7531
5799
6397
749
3618
8109
1072
2047
4155
5503
2170
138
8279
565
4608
900
5398
6517
1442
6399
6993
1675
8580
9770
9374
2657
2099
9297
1590
3830
3956
5472
5980
353
6220
5950
4813
7291
7996
8967
9145
6518
5457
7424
7082
64
8323
2479
2933
6116
5230
9925
7791
3809
6047
3516
2818
8145
2812
759
1974
6768
6230
4306
3472
8801
255
8284
6092
8250
3602
1588
1119
5410
5363
8200
1826
38
7031
4758
6153
2260
4682
295
2420
728
3810
1589
5224
2974
8699
3550
9741
1280
7855
9564
81
8109
7847
2524
2710
1448
4111
181
6858
5826
4732
5035
5863
1762
9792
8367
373
825
8662
9145
7905
2471
7085
3128
1796
5784
6677
1536
3415
883
1099
3495
5343
5297
2370
8053
3097
2833
8233
6306
8658
9316
1340
4520
7430
1131
2886
7802
1955
1547
3298
9859
370
6735
9339
2165
8870
2367
53
2284
3250
7503
5779
8592
2800
4500
2996
2248
7332
7580
8553
5989
6896
9892
6860
4325
7374
9746
8478
9328
7644
8128
5539
4365
4862
1229
2882
3731
3595
9286
6014
6844
6788
8144
5436
5939
2644
8431
8186
9975
6011
3090
2316
9258
2981
9175
3582
6706
5272
2059
6034
9268
186
7924
9984
5047
9152
2865
5129
2746
2150
1143
5942
5290
9286
1377
1228
8281
6159
5766
4608
8521
8855
6923
7778
8188
2449
1359
4893
4073
9770
7278
3340
6307
1553
3323
1354
704
2540
6482
9802
4689
3976
5743
6330
9614
3471
7558
4246
9629
9675
8853
4502
4881
2127
2279
9420
4576
9990
4313
8648
9759
7942
8339
2417
9495
8013
3770
6550
552
6604
6351
1593
6931
2093
7922
6544
5563
1831
790
1544
7857
5994
6045
2738
8121
4675
2157
2696
4664
2821
7695
774
763
6033
3191
6609
4045
3312
3158
4597
6267
5861
2541
3198
4305
462
6093
6220
8645
3234
7763
6501
9228
159
5590
3700
4833
7747
6395
5849
6919
441
2974
4033
6473
2516
641
6869
2180
151
7817
8446
2363
357
7995
6667
7171
4088
2886
5815
3673
7000
8667
9252
7158
4257
2951
8343
8355
5697
4191
5273
6137
3516
9306
8961
6032
6298
5830
8211
2800
3646
6656
5162
355
1003
1829
7525
1442
4714
9691
5114
8066
8357
4366
5223
8965
3668
3565
7319
9365
4107
2592
5501
7623
8249
4462
3654
898
6643
8216
3698
288
4871
8859
6994
2225
7039
4518
3666
1753
560