16,000,371 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: Help with calculating percentage in C Calin Negru20-Mar-22 8:41 Calin Negru 20-Mar-22 8:41
 Re: Help with calculating percentage in C RedDk21-Mar-22 7:16 RedDk 21-Mar-22 7:16
 Re: Help with calculating percentage in C Victor Nijegorodov20-Mar-22 7:42 Victor Nijegorodov 20-Mar-22 7:42
 Re: Help with calculating percentage in C ForNow20-Mar-22 9:02 ForNow 20-Mar-22 9:02
 Message Closed 18-Mar-22 15:23 Member 14968771 18-Mar-22 15:23
 Re: How to pass pointers and process them using ellipsis ? Richard MacCutchan18-Mar-22 23:08 Richard MacCutchan 18-Mar-22 23:08
 Message Closed 19-Mar-22 4:06 Member 14968771 19-Mar-22 4:06
 Re: How to pass pointers and process them using ellipsis ? k505419-Mar-22 5:01 k5054 19-Mar-22 5:01
 I'm not sure exactly where you're stuck. But lets start with the example you gave in your original post: C++ ```void PrintFloats (int n, ...) { int i; double val; printf ("Printing floats:"); va_list vl; va_start(vl,n); for (i=0;i``` Assuming that you're stuck here, then you might complete this something like C++ ```for(i = 0; i < n; ++i) { val = va_arg(vl, float); printf("%f ", val); } va_end(vl); putchar('\n'); ``` In this case I'm assuming that the `int n` parameter tells the function how many float values to expect. Other options to tell a variadic function how many arguments to expect are to use some sort of format string, like printf() does, or you can use some sort of sentinel value for your function e.g. C++ `PrintFloats(1.1, 2.2, -15.2, nan(""));` In this case we have assumed that a NaN won't be part of the input string, so is a fair choice for a sentinel. Keep Calm and Carry On
 Message Closed 19-Mar-22 8:44 Member 14968771 19-Mar-22 8:44
 Re: How to pass pointers and process them using ellipsis ? k505419-Mar-22 12:00 k5054 19-Mar-22 12:00
 Re: How to pass pointers and process them using ellipsis ? Richard MacCutchan19-Mar-22 6:11 Richard MacCutchan 19-Mar-22 6:11
 working with pointers Calin Negru17-Mar-22 21:48 Calin Negru 17-Mar-22 21:48
 Re: working with pointers Victor Nijegorodov17-Mar-22 23:16 Victor Nijegorodov 17-Mar-22 23:16
 Re: working with pointers Calin Negru18-Mar-22 0:12 Calin Negru 18-Mar-22 0:12
 Re: working with pointers Victor Nijegorodov18-Mar-22 1:39 Victor Nijegorodov 18-Mar-22 1:39
 Re: working with pointers Calin Negru18-Mar-22 10:20 Calin Negru 18-Mar-22 10:20
 going a bit further: working with pointers Calin Negru20-Mar-22 7:47 Calin Negru 20-Mar-22 7:47
 Re: working with pointers Mircea Neacsu18-Mar-22 10:19 Mircea Neacsu 18-Mar-22 10:19
 Re: working with pointers David Crow21-Mar-22 3:16 David Crow 21-Mar-22 3:16
 Re: working with pointers Calin Negru21-Mar-22 5:15 Calin Negru 21-Mar-22 5:15
 Code to Figure out x,y cords for CDC::Pie inside an CDC::Ellipse given % ForNow13-Mar-22 9:37 ForNow 13-Mar-22 9:37
 Re: Code to Figure out x,y cords for CDC::Pie inside an CDC::Ellipse given % Mircea Neacsu14-Mar-22 16:41 Mircea Neacsu 14-Mar-22 16:41
 Re: Code to Figure out x,y cords for CDC::Pie inside an CDC::Ellipse given % ForNow15-Mar-22 5:01 ForNow 15-Mar-22 5:01
 IPv6 address compression code using vc++ Member 1252773510-Mar-22 17:12 Member 12527735 10-Mar-22 17:12
 Re: IPv6 address compression code using vc++ Victor Nijegorodov10-Mar-22 21:06 Victor Nijegorodov 10-Mar-22 21:06
 Last Visit: 31-Dec-99 18:00     Last Update: 17-Sep-24 16:51 Refresh ᐊ Prev1...9293949596979899100101 Next ᐅ