Click here to Skip to main content
15,913,467 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: fstreaming a whole object (pointer) Pin
Hmmkk10-Nov-05 19:29
Hmmkk10-Nov-05 19:29 
GeneralRe: fstreaming a whole object (pointer) Pin
Christian Graus13-Nov-05 9:53
protectorChristian Graus13-Nov-05 9:53 
QuestionReading/editing registry on different .dat file? Pin
LordZoster9-Nov-05 11:40
LordZoster9-Nov-05 11:40 
Questionbinary hex conversion using stacks Pin
OttawaSenator9-Nov-05 6:57
OttawaSenator9-Nov-05 6:57 
AnswerRe: binary hex conversion using stacks Pin
mikanu9-Nov-05 7:12
mikanu9-Nov-05 7:12 
GeneralRe: binary hex conversion using stacks Pin
OttawaSenator9-Nov-05 11:10
OttawaSenator9-Nov-05 11:10 
GeneralRe: binary hex conversion using stacks Pin
mikanu10-Nov-05 16:32
mikanu10-Nov-05 16:32 
Question"please help assignment due soon" Pin
da_comp_learner7-Nov-05 16:07
da_comp_learner7-Nov-05 16:07 
how can I replace the array's and do something equivalent. I can't figure out how do change it...... i hav a mental block....


<code></code>
#define MAXVAL 10000000

char primes[MAXVAL];

int main ()
{
// initiallize the primes array
for (/*long*/ int i=0; i<MAXVAL; i++)
{
primes[i] = 0;
}

// Set primes[i] equal to 1 for all not prime numbers
for (/*long*/ int i=2; i</*sqrt((float)*/MAXVAL/*)*/; i++)
{
if (primes[i] == 0)
{
for (/*long*/ int notprime = 2*i; notprime < MAXVAL; notprime+=i)
{
primes[notprime] = 1;
}
}
}



long int test = 0;
// read input one at a time
//while(test>=4)
//{
cout<<"Please input a even integer greater than or equal to 4 : ";
while (cin >> test /*&& test >=4*/)
{
//if(test>=4)
//{
// loop through every possible odd sum
for(long int i=2; i<test/1; i+=1)
{

// if this is a valid prime sum, pring it and break to get the new input
if (primes[i] == 0 && primes[test-i] == 0)
{
int n = test;
int p = i;
int q = test - i;
cout << n << " = " << p << " + " << q << endl;
cout <<"The value of p is "<<p<<endl;
cout <<"The value of q is "<<q<<endl;

break;
}
//else
//cout<<"Invalid input..."<<endl;
//break;
}
//}
}
//}

pause();
return EXIT_SUCCESS;
}
<pre></pre>
AnswerRe: &amp;quot;please help assignment due soon&amp;quot; Pin
Christian Graus7-Nov-05 16:26
protectorChristian Graus7-Nov-05 16:26 
Questionmemory leak Pin
nineofhearts7-Nov-05 11:37
nineofhearts7-Nov-05 11:37 
AnswerRe: memory leak Pin
Christian Graus7-Nov-05 12:25
protectorChristian Graus7-Nov-05 12:25 
GeneralRe: memory leak Pin
nineofhearts7-Nov-05 13:21
nineofhearts7-Nov-05 13:21 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 13:41
protectorChristian Graus7-Nov-05 13:41 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 13:47
protectorChristian Graus7-Nov-05 13:47 
GeneralRe: memory leak Pin
nineofhearts7-Nov-05 15:59
nineofhearts7-Nov-05 15:59 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 16:02
protectorChristian Graus7-Nov-05 16:02 
GeneralRe: memory leak Pin
Kevin McFarlane13-Nov-05 4:22
Kevin McFarlane13-Nov-05 4:22 
AnswerRe: memory leak Pin
Joe Woodbury11-Nov-05 20:19
professionalJoe Woodbury11-Nov-05 20:19 
QuestionCallback with &quot;object&quot; parameter fails Pin
TriLogic7-Nov-05 10:39
TriLogic7-Nov-05 10:39 
QuestionC++ console Pin
iamboy7-Nov-05 9:05
iamboy7-Nov-05 9:05 
AnswerRe: C++ console Pin
Christian Graus7-Nov-05 9:50
protectorChristian Graus7-Nov-05 9:50 
QuestionAccessing control from another file Pin
Eran6-Nov-05 22:49
Eran6-Nov-05 22:49 
AnswerRe: Accessing control from another file Pin
Christian Graus7-Nov-05 9:53
protectorChristian Graus7-Nov-05 9:53 
Questionfstream help Pin
afrodriguez6-Nov-05 15:54
afrodriguez6-Nov-05 15:54 
AnswerRe: fstream help Pin
Christian Graus6-Nov-05 15:58
protectorChristian Graus6-Nov-05 15: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.