-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
1439 lines (1242 loc) · 37.4 KB
/
main.c
File metadata and controls
1439 lines (1242 loc) · 37.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <stdio.h>
#include <math.h>
#include <windows.h>
#include <conio.h>
void loadingBar()
{
// 0 - black background,
// A - Green Foreground
system("color 0A");
// Initialize char for printing
// loading bar
char a = 177, b = 219;
printf("\n\n\n\n");
printf("\n\n\n\n\t\t\t\t\t");
printf("Loading...\n\n");
printf("\t\t\t\t\t");
// Print initial loading bar
for (int i = 0; i < 26; i++)
printf("%c", a);
// Set the cursor again starting
// point of loading bar
printf("\r");
printf("\t\t\t\t\t");
// Print loading bar progress
for (int i = 0; i < 50; i++) {
printf("%c", b);
// Sleep for 1 second
Sleep(10);
}
}
void sampleProblems();
void menu();
void centralTendency(){
int size, i;
double sum = 0;
char letter;
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
printf("\t\t\tCENTRAL TENDENCY\n");
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n\n");
printf("Enter Limit: ");
printf("\033[0;33m");
scanf("%d",&size); //size of array
printf("\033[0;37m");
int dataset[size];
for( i = 0; i < size;i++){
printf("Enter Data set : ");
printf("\033[0;36m");
scanf("%d",&dataset[i]); //declaring array
printf("\033[0;37m");
}
// calculate the mean
float Msum = 0.0, avg;
for (i = 0; i < size; ++i) {
Msum += dataset[i];
}
avg = Msum / size;
// calculate the mode
int j, t, b[20] = {0}, k = 0, c = 1, max = 0, mode;
// search num
for (i = 0; i < size - 1; i++){
mode = 0;
for (j = i + 1; j < size; j++){
if (dataset[i] == dataset[j]) {
mode++;
}
}
if ((mode > max) && (mode != 0)){
k = 0;
max = mode;
b[k] = dataset[i];
k++;
}
else if (mode == max){
b[k] = dataset[i];
k++;
}
}
// calculation of variance and standard deviation
sum = 0;
double variance, deviation;
for ( i = 0; i < size; i++){
sum = sum + pow((dataset[i] - avg),2);
}
variance = sum / size;
deviation = sqrt(variance);
// print the result
for (i = 0; i < size; i++)
{
if (dataset[i] == b[i])
c++;
}
if (c == size)
printf("\nThere is \033[0;31mno mode\033[0;37m");
else
{
printf("\n\033[0;33mMode\033[0;37m = ");
for (i = 0; i < k; i++)
printf("%d ",b[i]);
}
printf("\n");
printf("Average = ");
printf("\033[0;32m");
printf("%.2f\n", avg); //result of the average
printf("\033[0;37m");
printf("Variance of elements: ");
printf("\033[0;32m");
printf("%.2lf\n", variance); //result of variance
printf("\033[0;37m");
printf("Standard deviation:");
printf("\033[0;32m");
printf(" %.2lf\n", deviation);//result of std
printf("\033[0;37m");
printf("\nWould you to keep using this tool?[Y/N]: ");
int f = 1;
while(f == 1){
scanf(" %c", &letter);
if (toupper(letter) == 'Y'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
centralTendency();
}if (toupper(letter) == 'N'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
menu();
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PLEASE TRY AGAIN...");
}
}
}
void hypothesisTesting(){
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
printf("\t\t\tHYPOTHESIS TESTING\n");
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n\n");
int i, limit1, limit2, total1, total2, total3;
float input1[100], sum1 = 0.0, sum2 = 0.0, mean1, mean2, var1, var2;
float input2[100], sumv1, sumv2, betmeans;
float sqd1[100], bet12, bet34, betf;
float sqd2[100], bet1, bet2, bet3, bet4;
char letter;
// user input#1
printf("Enter limit Array 1: ");
printf("\033[0;33m");
scanf("%d", &limit1);
printf("\033[0;37m");
for (i = 0; i < limit1; i++){
printf("\nEnter Data No.%d: ", i + 1);
printf("\033[0;36m");
scanf("%f", &input1[i]);
printf("\033[0;37m");
sum1 += input1[i];
sqd1[i] = input1[i] * input1[i];
sumv1 += sqd1[i];
}
// user input#2
printf("\nEnter limit Array 2: ");
printf("\033[0;33m");
scanf("%d", &limit2);
printf("\033[0;37m");
for (int i = 0; i < limit2; i++){
printf("\nEnter Data No.%d: ", i + 1);
printf("\033[0;36m");
scanf("%f", &input2[i]);
printf("\033[0;37m");
sum2 += input2[i];
sqd2[i] = input2[i] * input2[i];
sumv2 += sqd2[i];
}
// computation
mean1 = sum1 / limit1;
mean2 = sum2 / limit2;
var1 = (sumv1 / limit1) - (mean1 * mean1);
var2 = (sumv2 / limit2) - (mean2* mean2);
bet1 = (limit1 * var1) + (limit2 * var2);
bet2 = limit1 + limit2 - 2;
bet3 = limit1 + limit2;
bet4 = limit1 * limit2;
bet12 = bet1 / bet2;
bet34 = bet3 / bet4;
betf = bet12 * bet34;
betmeans = sqrt(betf);
double final = (mean1 - mean2) / betmeans;
//calculate for Z Test
double sum3 = 0;
sum1 = 0, sum2 = 0, mean1 = 0, mean2 = 0;
for( i = 0; i < limit1; i++){
sum1 += input1[i];
}
for( i = 0; i < limit2; i++){
sum2 += input2[i];
}
mean1 = sum1 / limit1;
mean2 = sum2 / limit2;
double std; //getting the Standard Deviation
double variance;
for( int i = 0; i < limit1; i++){
sum3 = sum3 + pow((input1[i]- mean1),2);
}
variance = sum3 / limit1;
std = sqrt(variance);
double z;
z = (mean2 - mean1) / std;
// printing answer
if(limit1 <= 30 && limit2 <= 30){
printf("Z Test Result: ");
printf("\033[0;32m");
printf("%.5lf", z);
printf("\033[0;37m");
}else{
printf("T Test Result: ");
printf("\033[0;32m");
printf("%.5lf\n", final);
printf("\033[0;37m");
}
printf("\nWould you to keep using this tool?[Y/N]: ");
int f = 1;
while(f == 1){
scanf(" %c", &letter);
if (toupper(letter) == 'Y'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
hypothesisTesting();
}if (toupper(letter) == 'N'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
menu();
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PLEASE TRY AGAIN...");
}
}
}
void pearsonr(){
int nth = 0, i;
char letter;
// pearson r
//enter the nth of data
// pearson r
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
printf("\t\t\t PEARSON r\n");
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n\n");
//enter the nth of data
printf("Enter Data set size: ");
printf("\033[0;33m");
scanf("%d", &nth);
printf("\033[0;37m");
double datasetX[nth], datasetY[nth], deviationX[nth], deviationY[nth], devMulti[nth], sqDevX[nth], sqDevY[nth];
// enter the dataset for x
printf("Enter Data set for X coordinate\n");
for(i = 0; i < nth; i++){
printf(" %d.) ", i + 1);
printf("\033[0;36m");
scanf("%lf", &datasetX[i]);
printf("\033[0;37m");
}
// enter the dataset for y
printf("\nEnter Data set for Y coordinate\n");
for(i = 0; i < nth; i++){
printf(" %d.) ", i + 1);
printf("\033[0;36m");
scanf("%lf", &datasetY[i]);
printf("\033[0;37m");
}
// calculate
double sumX = 0, sumY = 0, SP = 0, SSX = 0, SSY = 0, aveX, aveY;
for(i = 0; i < nth;i++){
//calculating the sum of both dataset
sumX += datasetX[i];
sumY += datasetY[i];
}
// calculate the ave of both dataset
aveX = sumX/nth;
aveY = sumY/nth;
for(i = 0; i < nth;i++){
// calculate the deviation from the mean
deviationX[i] = (datasetX[i] - aveX);
deviationY[i] = (datasetY[i] - aveY);
// multiply the deviation of x and y
devMulti[i] = deviationX[i] * deviationY[i];
//sum products of multiplied deviation
SP += devMulti[i];
//Squered of deviations
sqDevX[i] = deviationX[i] * deviationX[i];
sqDevY[i] = deviationY[i] * deviationY[i];
//sum of squares
SSX += sqDevX[i];
SSY += sqDevY[i];
}
// calculate the pearson r
double SSM = SSX * SSY;
double pearsonR = SP / sqrt(SSM);
// printf result
printf("Pearson r: ");
printf("\033[0;32m");
printf("%.2lf", pearsonR);
printf("\033[0;37m");
printf("\nWould you to keep using this tool?[Y/N]: ");
int f = 1;
while(f == 1){
scanf(" %c", &letter);
if (toupper(letter) == 'Y'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
pearsonr();
}if (toupper(letter) == 'N'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
menu();
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PLEASE TRY AGAIN...");
}
}
}
void anova(){
float ngroups, totalfirst = 0, totalsecond = 0, totalthird = 0, numgroups = 3;
float firstmean, secondmean, thirdmean, totalnumscores, sumscores, sqrdsumscores, totalsumsquares, sumsqrWT, sumsqrBT, degftotal, degfBT, degfWT, MSbet, MSwit, Fstats;
float firstdata[100], totalsqrdfirst = 0;
float seconddata[100], totalsqrdsecond = 0;
float thirddata[100], totalsqrdthird = 0;
float squaredfirst[100], sumofsqr1;
float squaredsecond[100], sumofsqr2;
float squaredthird[100], sumofsqr3;
int i;
char letter;
//input limit
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
printf("\t\t\t ANOVA\n");
printf("\t\t-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n\n");
//input limit
printf("Enter the number of scores in each treatment: ");
printf("\033[0;33m");
scanf("%f", &ngroups);
printf("\033[0;37m");
//input data
printf("\nInput data number for \033[0;31mFirst Group\033[0;37m.\n");
for ( i = 0; i < ngroups; i++){
printf(" %d.) ", i+1);
printf("\033[0;36m");
scanf("%f", &firstdata[i]);
printf("\033[0;37m");
totalfirst = totalfirst + firstdata[i];
squaredfirst[i] = firstdata[i] * firstdata[i];
totalsqrdfirst += squaredfirst[i];
}
printf("\nInput data number for \033[0;31mSecond Group\033[0;37m.\n");
for (i = 0; i < ngroups; i++){
printf(" %d.) ", i+1);
printf("\033[0;36m");
scanf("%f", &seconddata[i]);
printf("\033[0;37m");
totalsecond = totalsecond + seconddata[i];
squaredsecond[i] = seconddata[i] * seconddata[i];
totalsqrdsecond += squaredsecond[i];
}
printf("\nInput data number for \033[0;31mThird Group\033[0;37m.\n");
for (i = 0; i < ngroups; i++){
printf(" %d.) ", i+1);
printf("\033[0;36m");
scanf("%f", &thirddata[i]);
printf("\033[0;37m");
totalthird = totalthird + thirddata[i];
squaredthird[i] = thirddata[i] * thirddata[i];
totalsqrdthird += squaredthird[i];
}
//mean formula
firstmean = totalfirst / ngroups;
secondmean = totalsecond / ngroups;
thirdmean = totalthird / ngroups;
totalnumscores = ngroups * numgroups;
//Calculation
sumscores = totalfirst + totalsecond + totalthird;
sqrdsumscores = totalsqrdfirst + totalsqrdsecond + totalsqrdthird;
sumofsqr1 = totalsqrdfirst - (pow(totalfirst, 2) / ngroups);
sumofsqr2 = totalsqrdsecond - (pow(totalsecond, 2) / ngroups);
sumofsqr3 = totalsqrdthird - (pow(totalthird, 2) / ngroups);
//SSformula
totalsumsquares = sqrdsumscores - (pow(sumscores, 2) / totalnumscores);
sumsqrWT = sumofsqr1 + sumofsqr2 + sumofsqr3;
sumsqrBT = totalsumsquares - sumsqrWT;
degftotal = totalnumscores - 1;
degfWT = totalnumscores - numgroups;
degfBT = numgroups - 10;
//MS formula
MSbet = sumsqrBT / degfBT;
MSwit = sumsqrWT / degfWT;
//formula for value of F
Fstats = MSbet / MSwit;
printf("\nF-statistic value = ");
printf("\033[0;32m");
printf("%2.f", Fstats);
printf("\033[0;37m");
printf("\nWould you to keep using this tool?[Y/N]: ");
int f = 1;
while(f == 1){
scanf(" %c", &letter);
if (toupper(letter) == 'Y'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
anova();
}if (toupper(letter) == 'N'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
menu();
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PLEASE TRY AGAIN...");
}
}
}
void centralexl(){
int flag=1;
int flag1=1;
char let;
//dataset for central tendency
int ctsample1[] = {23, 34, 45, 21, 23, 34, 54, 34, 23, 76};
double ctmean = 36.7;
int ctmode = 23;
double ctstd = 17.46138597;
double ctvar = 304.9;
int ctsample2[] = {23, 34, 56, 43, 23, 23, 12, 16, 17, 15};
double ctmean2 = 26.2;
int ctmode2 = 23;
double ctstd2 = 14.05386463;
double ctvar2 = 197.5111111;
int ctsample3[] = {52, 59, 23, 27, 43, 23, 45, 67, 89, 43};
double ctmean3 = 47.1;
int ctmode3 = 23;
double ctstd3 = 20.87236344;
double ctvar3 = 435.6555556;
char enput1;
int enput, enput2, enput3, enput4, tenput, zenput;
// sample 1,2,3 for central tendency
printf("\033[0;37m");
system("cls");
printf("[\033[0;32m1\033[0;37m] Sample 1\n");
printf("[\033[0;32m2\033[0;37m] Sample 2\n");
printf("[\033[0;32m3\033[0;37m] Sample 3\n");
printf("[\033[0;32m4\033[0;37m] Back\n");
printf("\n");
while(flag1==1){
scanf(" %c", &enput1);
// sample 1 ct
if (enput1 == '1'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m\n", i + 1, ctsample1[i]); // data sets //you finished this
}
printf("\nExcel Calculator Results: ");
printf("\nMean = \033[0;33m%.1lf\033[0;37m", ctmean);
printf("\nMode = \033[0;33m%d\033[0;37m", ctmode);
printf("\nStandard Deviation = \033[0;33m%.8lf\033[0;37m", ctstd);
printf("\nVariance = \033[0;33m%.1lf\033[0;37m", ctvar);
printf("\n\nStatistical Tools Results: ");
printf("\nMode = \033[0;33m23.34\033[0;37m");
printf("\nMean = \033[0;33m36.70\033[0;37m");
printf("\nStandard Deviation = \033[0;33m16.57\033[0;37m");
printf("\nVariance = \033[0;33m274.41\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Main Menu: ");
flag1--;
while(flag == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
centralexl();
}
else if (toupper(let) == 'N'){
system("cls");
sampleProblems();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
// sample 2 ct
else if (enput1 == '2'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m\n", i + 1, ctsample2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nMean = \033[0;33m%.1lf\033[0;37m", ctmean2);
printf("\nMode = \033[0;33m%d\033[0;37m", ctmode2);
printf("\nStandard Deviation = \033[0;33m%.8lf\033[0;37m", ctstd2);
printf("\nVariance = \033[0;33m%.7lf\033[0;37m", ctvar2);
printf("\n\nStatistical Tools Results: ");
printf("\nMode = \033[0;33m23\033[0;37m");
printf("\nMean = \033[0;33m26.20\033[0;37m");
printf("\nStandard Deviation = \033[0;33m13.33\033[0;37m");
printf("\nVariance = \033[0;33m177.76\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Main Menu: ");
flag1--;
while(flag == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
centralexl();
}
else if (toupper(let) == 'N'){
system("cls");
sampleProblems();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
//sample 3 ct
else if (enput1 == '3'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m\n", i + 1, ctsample3[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nMean = \033[0;33m%.1lf\033[0;37m", ctmean3);
printf("\nMode = \033[0;33m%d\033[0;37m", ctmode3);
printf("\nStandard Deviation = \033[0;33m%.8lf\033[0;37m", ctstd3);
printf("\nVariance = \033[0;33m%.7lf\033[0;37m", ctvar3);
printf("\n\nStatistical Tools Results: ");
printf("\nMode = \033[0;33m23.43\033[0;37m");
printf("\nMean = \033[0;33m47.10\033[0;37m");
printf("\nStandard Deviation = \033[0;33m19.80\033[0;37m");
printf("\nVariance = \033[0;33m392.09\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Main Menu: ");
flag1--;
while(flag == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
centralexl();
}
else if (toupper(let) == 'N'){
system("cls");
sampleProblems();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}else if (enput1 == '4'){
system("cls");
sampleProblems();
flag1--;
}else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}//END OF CENTRAL!!!!!
void hypomain();
void hypoT(){// t test
//dataset for T Test
int Tsample1g1[] = {23, 34, 45, 21, 23, 34, 54, 34, 23, 76};
int Tsample1g2[] = {34, 56, 43, 23, 45, 21, 23, 54, 34, 23};
double Tsample1Ans = 0.1584689807;
int Tsample2g1[] = {23, 34, 56, 43, 23, 23, 12, 16, 17, 15};
int Tsample2g2[] = {56, 43, 23, 45, 21, 23, 54, 34, 23, 23};
double Tsample2Ans = -1.328288122;
int enput, enput1,enput3, enput4, zenput;
char tenput, let;
int Tsample3g1[] = {52, 59, 23, 27, 43, 23, 45, 67, 89, 43};
int Tsample3g2[] = {45, 21, 27, 43, 23, 56, 43, 23, 43, 23};
double Tsample3Ans = 1.609048316;
int flag = 1;
int flag2 =1;
system("cls");
printf("[\033[0;32m1\033[0;37m] Sample 1\n");
printf("[\033[0;32m2\033[0;37m] Sample 2\n");
printf("[\033[0;32m3\033[0;37m] Sample 3\n");
printf("[\033[0;32m4\033[0;37m] Back");
printf("\n");
while(flag == 1){
scanf(" %c", &tenput);
// sample 1 t test
if (tenput == '1'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Tsample1g1[i], Tsample1g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nT Test Result: \033[0;32m%.8lf\033[0;37m", Tsample1Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nT Test Result: \033[0;32m0.16\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoT();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
// sample 2 t test
else if (tenput == '2'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Tsample2g1[i], Tsample2g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nT Test Result: \033[0;32m%.8lf\033[0;37m", Tsample2Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nT Test Result: \033[0;32m-1.33\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoT();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
// sample 3 t test
else if (tenput == '3'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 10; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Tsample3g1[i], Tsample3g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nT Test Result: \033[0;32m%.8lf\033[0;37m", Tsample3Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nT Test Result: \033[0;32m1.61\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoT();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}else if(tenput == '4'){
system("cls");
hypomain();
}else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
void hypoZ(){// z test
// dataset for Z Test
int Zsample1g1[] = {34, 45, 21, 46, 56, 49, 23, 43, 68, 34, 23, 23, 45, 21, 45, 21, 23, 96, 95, 100, 90, 45, 90, 34, 20, 23, 23, 43, 96, 34};
int Zsample1g2[] = {56, 43, 23, 34, 23, 45, 21, 45, 21, 23, 56, 43, 23, 23, 43, 96, 34, 23, 23, 45, 23, 43, 23, 34, 39, 28, 45, 23, 34, 23};
double Zsample1Ans = -0.4340;
int Zsample2g1[] = {95, 34, 32, 45, 23, 32, 45, 23, 23, 23, 43, 21, 23, 56, 43, 23, 45, 59, 23, 27, 43, 45, 43, 23, 23, 12, 45, 21, 45, 21};
int Zsample2g2[] = {23, 45, 23, 23, 56, 43, 23, 23, 34, 23, 23, 23, 34, 23, 45, 21, 23, 21, 27, 43, 23, 10, 10, 21, 23, 54, 45, 59, 23, 27};
double Zsample2Ans = -0.3318;
int Zsample3g1[] = {43, 23, 23, 45, 21, 45, 21 ,45 ,34 ,23 ,34 ,23, 45, 21, 23, 21, 23, 23, 23, 23, 34, 23, 23, 34, 23, 45, 21, 23, 21, 23};
int Zsample3g2[] = {21, 23, 56, 43, 23, 45, 23, 43, 23, 56, 43, 23, 23, 34, 23, 45, 45, 21, 23, 23, 23, 45, 43, 96, 34, 21, 45, 21, 45, 23};
double Zsample3Ans = 0.7357;
char let,zenput;
int enput, enput1,enput3, enput4, tenput;
int flag = 1;
int flag2 = 1;
system("cls");
printf("[\033[0;32m1\033[0;37m] Sample 1\n");
printf("[\033[0;32m2\033[0;37m] Sample 2\n");
printf("[\033[0;32m3\033[0;37m] Sample 3\n");
printf("[\033[0;32m4\033[0;37m] Back\n");
printf("\n");
while(flag==1){
scanf(" %c", &zenput);
// sample 1 z test
if (zenput == '1'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 30; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Zsample1g1[i], Zsample1g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nZ Test Result: \033[0;32m%.4lf\033[0;37m", Zsample1Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nZ Test Result: \033[0;32m-0.44141\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoZ();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
// sample 2 z test
else if (zenput == '2'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 30; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Zsample2g1[i], Zsample2g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nZ Test Result: \033[0;32m%.4lf\033[0;37m", Zsample2Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nZ Test Result: \033[0;32m-0.33752\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoZ();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}
else if (zenput == '3'){
system("cls");
loadingBar();
system("cls");
printf("\033[0;37m");
for (int i = 0; i < 30; ++i){
printf("Data set %d: \033[0;36m%d\033[0;37m \033[0;36m%d\033[0;37m\n", i + 1, Zsample3g1[i], Zsample3g2[i]); // data sets
}
printf("\nExcel Calculator Results: ");
printf("\nZ Test Result: \033[0;32m%.4lf\033[0;37m", Zsample3Ans);
printf("\n\nStatistical Tools Results: ");
printf("\nZ Test Result: \033[0;32m0.74829\033[0;37m");
printf("\n\nType [Y] to go back to Sample menu or type [N] to go back to Test Select: ");
flag--;
while(flag2 == 1){
scanf(" %c", &let);
if (toupper(let) == 'Y'){
flag--;
system("cls");
hypoZ();
}
else if (toupper(let) == 'N'){
system("cls");
hypomain();
flag--;
}
else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
}else if(zenput == '4'){
system("cls");
hypomain();
}else{
printf("\033[0;31mINVALID INPUT\033[0;37m, PRESS ENTER AGAIN....\n");
}
}
} // end of HYPOYAWA
void hypomain(){ //hypothesus start
char enput2;
system("cls");
printf("\033[0;37m");
printf("[\033[0;32m1\033[0;37m] T Test\n");
printf("[\033[0;32m2\033[0;37m] Z Test\n");
printf("[\033[0;32m3\033[0;37m] Back");
printf("\n");
int flag = 1;
while(flag == 1){
scanf(" %c", &enput2);
if(enput2 == '1'){