tyronv's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 13 (0.06 per day)
- Joined:
- 25-November 12
- Profile Views:
- 84
- Last Active:
Jan 27 2013 02:55 PM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Lottery winner
Posted 15 Dec 2012
Thanks for all the help, however I just noticed that when I enter another winning number other than 77777 it returns sorry you are not a winner. Any suggestions why this is happening? -
In Topic: Dynamically allocate an array and find the mode.
Posted 2 Dec 2012
I tried this so far and am getting an error,
#include <stdio.h> #include <stdlib.h> #include <malloc.h> int * getIntegers(int *); void displayIntegers(int *,int); void sortIntegers(int *integers, int size); int modeIntegers(int *integers, int size); int main() { int i; int *testIntegers = NULL; int numberIntegers = 0; int mode; testIntegers = getIntegers(&numberIntegers); sortIntegers(testIntegers, numberIntegers); displayIntegers(testIntegers,numberIntegers); printf("The average is: %d\n",mode); fflush(stdout); free (testIntegers); system("pause"); return 0; } int *getIntegers(int *sizep) { int i; int *myArray; int *iptr; printf("How many Integers do you want? "); fflush(stdout); scanf(" %d",sizep); myArray = calloc(*sizep , sizeof(int)); /* using array notation*/ for (i = 0; i < *sizep; i++) { printf("\tIntegers %d: ",i+1); fflush(stdout); scanf(" %d",&myArray[i]); } return myArray; } void displayIntegers(int *integers, int size) { /* array */ int i; for (i = 0; i < size; i++) printf("%d\n",integers[i]); fflush(stdout); } void sortIntegers(int *integers, int size) { /* Selection sort as an array */ int inner, outer, hold; for (outer = 0; outer < size -1; outer++) for (inner = outer + 1; inner < size; inner++) { if (integers[outer] > integers[inner]) { // swap them hold = integers[outer]; integers[outer] = integers[inner]; integers[inner] = hold; } } } int modeIntegers(int *integers, int size) { int run = 0; int run = 0; int runTotal; int mode; int mode; if (integers[i] == integers) runTotal++; if (run > runTotal) return mode; } -
In Topic: Dynamically allocate an array and find the mode.
Posted 2 Dec 2012
but where will you loop it, can you proide a smaple code. Sorry I am totally lost om this -
In Topic: Dynamically allocate an array and find the mode.
Posted 2 Dec 2012
but where will you loop it, can you proide a smaple code. Sorry I am totally lost om this -
In Topic: Dynamically allocate an array and find the mode.
Posted 2 Dec 2012
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
tyronv hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
tyronv has no profile comments yet. Why not say hello?