Click here to Skip to main content
16,011,611 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Distributing my VC++ app Pin
David Crow20-May-04 4:11
David Crow20-May-04 4:11 
GeneralRe: Distributing my VC++ app Pin
Michael Dunn20-May-04 5:15
sitebuilderMichael Dunn20-May-04 5:15 
GeneralXOR Operation Pin
vijayaramaraju20-May-04 1:50
vijayaramaraju20-May-04 1:50 
GeneralRe: XOR Operation Pin
Kamyar Souri20-May-04 9:38
Kamyar Souri20-May-04 9:38 
Questionhow do i change toolbar button bitmaps Pin
Member 63398320-May-04 0:54
Member 63398320-May-04 0:54 
QuestionVariable argument functions- how to? Pin
Ernesto D.19-May-04 23:44
Ernesto D.19-May-04 23:44 
AnswerRe: Variable argument functions- how to? Pin
Maxwell Chen19-May-04 23:49
Maxwell Chen19-May-04 23:49 
AnswerRe: Variable argument functions- how to? Pin
Prakash Nadar20-May-04 0:06
Prakash Nadar20-May-04 0:06 
#include <stdarg.h>
#include <iostream.h>
double average(int num, ...)
{
  va_list arguments;        //A place to store the list of arguments
  va_start(arguments, num); //Initializing arguments to store all values
  int sum=0;		     // passed in after num    
  for(int x=0; x<num; x++)   //Loop until all numbers are added
    sum+=va_arg(arguments, double); //Adds the next value in argument list to sum.
  va_end(arguments);      //Cleans up the list
  return sum/(double)num;    //Returns some number (typecast prevents truncation)
}
int main()
{
  cout<<average(3, 12.2, 22.3, 4.5)<<endl;
  cout<<average(5, 3.3, 2.2, 1.1, 5.5, 3.3)<<endl;
  return 0;
}



I'll write a suicide note on a hundred dollar bill - Dire Straits
GeneralRe: Variable argument functions- how to? Pin
Ernesto D.20-May-04 10:37
Ernesto D.20-May-04 10:37 
GeneralEmptying ListBox Pin
shals16919-May-04 23:12
shals16919-May-04 23:12 
GeneralRe: Emptying ListBox Pin
Andrew Quinn AUS19-May-04 23:15
Andrew Quinn AUS19-May-04 23:15 
GeneralRe: Emptying ListBox Pin
shals16919-May-04 23:28
shals16919-May-04 23:28 
GeneralResetContents doesn't work Pin
shals16919-May-04 23:28
shals16919-May-04 23:28 
GeneralRe: ResetContents doesn't work Pin
Andrew Quinn AUS19-May-04 23:54
Andrew Quinn AUS19-May-04 23:54 
GeneralGeneral Class Question Pin
sweep12319-May-04 22:55
sweep12319-May-04 22:55 
GeneralRe: General Class Question Pin
Andrew Quinn AUS19-May-04 23:13
Andrew Quinn AUS19-May-04 23:13 
GeneralRe: General Class Question Pin
sweep12319-May-04 23:21
sweep12319-May-04 23:21 
Generalwchar_t* wsz = L .. proplem .. Pin
rasha200319-May-04 22:00
rasha200319-May-04 22:00 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
Anthony_Yio19-May-04 22:25
Anthony_Yio19-May-04 22:25 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
rasha200319-May-04 23:05
rasha200319-May-04 23:05 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
Anthony_Yio20-May-04 0:49
Anthony_Yio20-May-04 0:49 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
rasha200322-May-04 19:44
rasha200322-May-04 19:44 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
Mahendra_78619-May-04 22:42
Mahendra_78619-May-04 22:42 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
Michael Dunn20-May-04 5:09
sitebuilderMichael Dunn20-May-04 5:09 
GeneralRe: wchar_t* wsz = L .. proplem .. Pin
Anonymous20-May-04 6:01
Anonymous20-May-04 6:01 

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.