Click here to Skip to main content
15,895,824 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionthe program exit after creating process in the solaris Pin
jonesliu24-Oct-12 0:51
jonesliu24-Oct-12 0:51 
AnswerRe: the program exit after creating process in the solaris Pin
Richard MacCutchan24-Oct-12 1:06
mveRichard MacCutchan24-Oct-12 1:06 
QuestionFinding Min and Max of array Pin
Mikerush723-Oct-12 6:50
Mikerush723-Oct-12 6:50 
AnswerRe: Finding Min and Max of array Pin
jeron123-Oct-12 7:36
jeron123-Oct-12 7:36 
AnswerRe: Finding Min and Max of array Pin
Chris Losinger23-Oct-12 8:31
professionalChris Losinger23-Oct-12 8:31 
AnswerRe: Finding Min and Max of array Pin
CPallini23-Oct-12 10:47
mveCPallini23-Oct-12 10:47 
AnswerRe: Finding Min and Max of array Pin
«_Superman_»23-Oct-12 19:34
professional«_Superman_»23-Oct-12 19:34 
AnswerRe: Finding Min and Max of array Pin
Sajeesh Payolam23-Oct-12 20:10
Sajeesh Payolam23-Oct-12 20:10 
You canot write this way
C++
double array [i];
beacuse here i is not initialized. so when compiling compiler will give the error like
1. Array unknown size
2. cannot allocate an array of constant size size 0.
2. expected constant expression.

so you can write this way
C++
double array[10]

or dynamically allocate the array.

C#
printf("Enter %d elements in to the array: ", size);
scanf("%d",&array[i]);

why you are write in this way? you just think how to read the required number of elements in to array without a loop? so reading of this array with in a loop, ie see below
C++
printf("Enter %d elements in to the array: ", size);
for( i = 0; i < size; i++ )
{
    scanf("%d",&array[i]);
}


also an important note when writing the code is give meaning full name for variable. because this will increase the readability of your code. Also keep a coding standard when writing code.
Next is the logic which is used to find minimum and maximum value from the array.
you can optimise your code like this way
double Min = array[0];
double Max = array[0];
C++
for( i = 0; i < size; i++ )
{
    if( Max < array[i] )
    {
        Max = array[i];
    }
    if( Min > array[i] )
    {
        Min = array[i]
    }
}

so code optimization is important when coding in large projects.
Thanks
GeneralRe: Finding Min and Max of array Pin
Mikerush724-Oct-12 3:28
Mikerush724-Oct-12 3:28 
QuestionHow to delete Registry Key with Maximum rights Pin
platso_58823-Oct-12 2:40
platso_58823-Oct-12 2:40 
AnswerRe: How to delete Registry Key with Maximum rights Pin
Jochen Arndt23-Oct-12 3:02
professionalJochen Arndt23-Oct-12 3:02 
GeneralRe: How to delete Registry Key with Maximum rights Pin
platso_58824-Oct-12 5:17
platso_58824-Oct-12 5:17 
GeneralRe: How to delete Registry Key with Maximum rights Pin
Jochen Arndt24-Oct-12 5:45
professionalJochen Arndt24-Oct-12 5:45 
GeneralRe: How to delete Registry Key with Maximum rights Pin
platso_58824-Oct-12 20:27
platso_58824-Oct-12 20:27 
GeneralRe: How to delete Registry Key with Maximum rights Pin
Jochen Arndt24-Oct-12 21:15
professionalJochen Arndt24-Oct-12 21:15 
Questionmessage CBN_SELENDOK not sent when using mouse Pin
NoviceEx23-Oct-12 2:07
NoviceEx23-Oct-12 2:07 
AnswerRe: message CBN_SELENDOK not sent when using mouse Pin
Jochen Arndt23-Oct-12 2:51
professionalJochen Arndt23-Oct-12 2:51 
GeneralRe: message CBN_SELENDOK not sent when using mouse Pin
NoviceEx23-Oct-12 3:05
NoviceEx23-Oct-12 3:05 
GeneralRe: message CBN_SELENDOK not sent when using mouse Pin
Jochen Arndt23-Oct-12 3:23
professionalJochen Arndt23-Oct-12 3:23 
GeneralRe: message CBN_SELENDOK not sent when using mouse Pin
NoviceEx23-Oct-12 21:48
NoviceEx23-Oct-12 21:48 
QuestionLinker error LNK2001 ("external symbol not found") Pin
tiwal22-Oct-12 4:56
tiwal22-Oct-12 4:56 
QuestionRe: Linker error LNK2001 ("external symbol not found") Pin
Richard MacCutchan22-Oct-12 5:16
mveRichard MacCutchan22-Oct-12 5:16 
AnswerRe: Linker error LNK2001 ("external symbol not found") Pin
tiwal22-Oct-12 20:56
tiwal22-Oct-12 20:56 
GeneralRe: Linker error LNK2001 ("external symbol not found") Pin
Richard MacCutchan22-Oct-12 22:18
mveRichard MacCutchan22-Oct-12 22:18 
GeneralRe: Linker error LNK2001 ("external symbol not found") Pin
tiwal22-Oct-12 22:58
tiwal22-Oct-12 22:58 

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.