Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Function to get the local system Administrator Name Pin
Taruni16-Oct-08 19:20
Taruni16-Oct-08 19:20 
GeneralRe: Function to get the local system Administrator Name Pin
Naveen16-Oct-08 19:42
Naveen16-Oct-08 19:42 
GeneralRe: Function to get the local system Administrator Name Pin
Taruni16-Oct-08 20:00
Taruni16-Oct-08 20:00 
QuestionRe: Function to get the local system Administrator Name Pin
David Crow17-Oct-08 4:02
David Crow17-Oct-08 4:02 
AnswerRe: Function to get the local system Administrator Name Pin
enhzflep16-Oct-08 18:58
enhzflep16-Oct-08 18:58 
QuestionHow can I remove an item in Combo box's list box ? Pin
SherTeks16-Oct-08 18:18
SherTeks16-Oct-08 18:18 
AnswerRe: How can I remove an item in Combo box's list box ? Pin
AlexAbramov16-Oct-08 19:59
AlexAbramov16-Oct-08 19:59 
QuestionI need help figuring this out please Pin
LilKoopa16-Oct-08 18:05
LilKoopa16-Oct-08 18:05 
I was wondering if someone could look at my code and tell me why when i try to get the average of the array it wont give me the average. It compiles, the only problem is the sum and average are the same. here is my code



// LanusArrays.cpp : Defines the entry point for the console application.
// Corey Lanus
// Test 2 Part 2
// Lanus Arrays
// Does a lot of things dealing with arrays.
// October 16, 2006

#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;


int main()
{
const int ARRAY_SIZE = 20;
int numbers[ARRAY_SIZE];
int count;
ifstream inputFile;

inputFile.open("numbers.txt");

for (count = 0; count < ARRAY_SIZE; count++)
inputFile >> numbers[count];

inputFile.close();

int total = 0;
for (int count = 0; count < ARRAY_SIZE; count++)
total += numbers[count];
cout << "The sum of the numbers is: "<< total << endl;
cout << endl;

double total2 = 0;
double average;
for (int count = 0; count < ARRAY_SIZE; count++)
total2 += numbers[count];
average = total2 / ARRAY_SIZE;
cout << "The average of the numbers is: "<< total2 << endl;
cout << endl;


int highest;
highest = numbers[0];
for (count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] > highest)
highest = numbers[count];
}
cout << "The highest number is: " << highest << endl;
cout << endl;


int lowest;
lowest = numbers[0];
for (count = 1; count < ARRAY_SIZE; count++)
{
if (numbers[count] < lowest)
lowest = numbers[count];
}
cout << "The lowest number is: " << lowest << endl;
cout << endl;

cout << "The numbers are: ";
for (count = 0; count < ARRAY_SIZE; count++)
cout << numbers[count] << " ";
cout << endl;

cout << "The numbers are:\n ";
for (count = 0; count < ARRAY_SIZE; count++)
cout << numbers[count] << " \n";
cout << endl;
return 0;
}
AnswerRe: I need help figuring this out please Pin
User 21559716-Oct-08 18:36
User 21559716-Oct-08 18:36 
GeneralRe: I need help figuring this out please Pin
LilKoopa17-Oct-08 7:51
LilKoopa17-Oct-08 7:51 
AnswerRe: I need help figuring this out please Pin
David Crow17-Oct-08 8:52
David Crow17-Oct-08 8:52 
QuestionInterface Design Question Pin
mombawomba16-Oct-08 16:08
mombawomba16-Oct-08 16:08 
AnswerRe: Interface Design Question Pin
Graham Shanks16-Oct-08 23:43
Graham Shanks16-Oct-08 23:43 
QuestionNew to MFC Pin
BobInNJ16-Oct-08 14:51
BobInNJ16-Oct-08 14:51 
AnswerRe: New to MFC Pin
mombawomba16-Oct-08 16:22
mombawomba16-Oct-08 16:22 
QuestionAssignment Code Pin
dtaylor0116-Oct-08 12:53
dtaylor0116-Oct-08 12:53 
AnswerRe: Assignment Code Pin
BobInNJ16-Oct-08 13:40
BobInNJ16-Oct-08 13:40 
GeneralRe: Assignment Code Pin
dtaylor0116-Oct-08 14:21
dtaylor0116-Oct-08 14:21 
GeneralRe: Assignment Code Pin
BobInNJ16-Oct-08 14:29
BobInNJ16-Oct-08 14:29 
GeneralRe: Assignment Code Pin
dtaylor0116-Oct-08 14:36
dtaylor0116-Oct-08 14:36 
GeneralRe: Assignment Code Pin
BobInNJ16-Oct-08 14:40
BobInNJ16-Oct-08 14:40 
GeneralRe: Assignment Code [modified] Pin
dtaylor0116-Oct-08 14:46
dtaylor0116-Oct-08 14:46 
GeneralRe: Assignment Code Pin
BobInNJ16-Oct-08 14:57
BobInNJ16-Oct-08 14:57 
GeneralRe: Assignment Code Pin
dtaylor0116-Oct-08 15:05
dtaylor0116-Oct-08 15:05 
QuestionRegEnumValue() returns garbage value for DWORD and BINARY Datatype! Pin
Supriya Tonape16-Oct-08 11:38
Supriya Tonape16-Oct-08 11:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.