marshaHB's Profile
Reputation: 0
Apprentice
- Group:
- New Members
- Active Posts:
- 7 (0.07 per day)
- Joined:
- 10-February 13
- Profile Views:
- 35
- Last Active:
Feb 15 2013 09:53 PM- Currently:
- Offline
Previous Fields
- Country:
- Who Cares
- OS Preference:
- Who Cares
- Favorite Browser:
- Who Cares
- Favorite Processor:
- Intel
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Dodge
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: dynamic allocation
Posted 12 Feb 2013
come on snoopy dnt give up on me
i know i am kinda slow but its only cause its been like a month or since i started this course i promise i will do better -
In Topic: dynamic allocation
Posted 11 Feb 2013
snoopy the program doesnt go beyond performing the average is my sorting function wrong -
In Topic: dynamic allocation
Posted 11 Feb 2013
do i enter this on line 27 and since i cant leave the for loop do i nest it in the do while loop? -
In Topic: dynamic allocation
Posted 10 Feb 2013
#include <iostream> #include <iomanip> using namespace std; //Function prototypes void arrSelectSort(double *, int); int main() { double *TestScores, //To dynamically allocate an array total = 0.0, //Accumulator average; //To hold average test scores int numTest, //To hold number of test scores count; //Counter variable //Get the number of test scores you wish to average and put in order cout << "How many test scores are you entering? "; cin >> numTest; //Dynamically allocate an array large enough to hold that many scores TestScores = new double[numTest]; //Get the test scores cout << "Enter the test scores below.\n"; for (count = 0; count < numTest; count++) { cout << "Test Score " << (count + 1) << ": "; cin >> TestScores[count]; } //Calculate the total test scores for (count = 0; count < numTest; count++) { total += TestScores[count]; } //Calculate the average test scores average = total / numTest; //Dsiplay the results cout << fixed << showpoint << setprecision(2); cout << "The average of all the test scores is " << average << endl; //Free dynamically allocated memory delete [] TestScores; TestScores = 0; //make TestScores point to null //An array of pointers to int int *arrPtrTestScores[count]; //Sort the elements of the array of pointers arrSelectSort(TestScores, TestScores[count]); //Display the Test Scores in ascending order cout << "The test scores in ascending order are: \n"; return 0; } //This function performs an ascending order selection sort void arrSelectSort(double *arr, int size) { int startScan; double minIndex; double minElem; for (startScan = 0; startScan < (size - 1); startScan++) { minIndex = startScan; minElem = arr[startScan]; for(int index = startScan + 1; index < size; index++) { if (arr[index] < minElem) { minElem = arr[index]; minIndex = index; } } arr[(int)minIndex] = arr[startScan]; arr[startScan] = minElem; } } -
In Topic: dynamic allocation
Posted 10 Feb 2013
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Click here to e-mail me
Friends
marshaHB hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given

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