Click here to Skip to main content
16,006,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about sockets Pin
22491730-Mar-04 19:31
22491730-Mar-04 19:31 
GeneralOnOK() Pin
ykg888@yahoo.com30-Mar-04 18:55
sussykg888@yahoo.com30-Mar-04 18:55 
GeneralRe: OnOK() Pin
Prakash Nadar30-Mar-04 20:26
Prakash Nadar30-Mar-04 20:26 
GeneralRe: OnOK() Pin
David Crow31-Mar-04 2:37
David Crow31-Mar-04 2:37 
GeneralTAPI related Pin
Ahmed Jahanzeb30-Mar-04 17:58
sussAhmed Jahanzeb30-Mar-04 17:58 
GeneralRe: TAPI related Pin
Michael P Butler30-Mar-04 21:59
Michael P Butler30-Mar-04 21:59 
GeneralRe: TAPI related Pin
Filomela5-May-04 5:18
Filomela5-May-04 5:18 
GeneralInteresting problems Pin
FlyingDancer30-Mar-04 15:08
FlyingDancer30-Mar-04 15:08 
Program Code:

#include<stdio.h>
#include<time.h>

#define N 1024
int i,j,k;
float slice[N][N];

void main()
{
time_t start,end;
float s;
start=time(NULL);

for(k=0;k<100;k++)
{
for(j=0;j<n;j++)
="" for(i="0;i<N;i++)" {=""
<code=""> slice[i][j]=(float)(slice[i][j]+0.01);
slice[j][i]=(float)(slice[j][i]+0.01);
}
printf("%d\n",k);
}

end=time(NULL);
s=difftime(end,start);
printf(" The total time is %f:",s);
}

Questions or problems(Compiled by Visual C++ 6.0):
1.If N equals 1022,1023,1025 or 1026, its run time is about 13 seconds, else if N=1024 that will be about 56 seconds. that is, the speed is very different.
2. "slice[j][i]=(float)(slice[j][i]+0.01)" is executed over two times faster than "slice[i][j]=(float)(slice[i][j]+0.01);". You can have a try by cutting off one of these sentences.
3. An exception will happen if "int i,j,k; float slice[N][N];" is moved into function main() that says "test.exe has encountered a problem and needs to close. We are sorry for the inconvenience.". In addition, my program is named by "test.cpp"

Have you known these problems?
and could you give me an explanation
and how to avoid these bad results
please

Any is appreciated!
Thanks!
GeneralRe: Interesting problems Pin
Maxwell Chen30-Mar-04 16:24
Maxwell Chen30-Mar-04 16:24 
GeneralRe: Interesting problems Pin
FlyingDancer30-Mar-04 18:45
FlyingDancer30-Mar-04 18:45 
GeneralRe: Interesting problems Pin
ohadp30-Mar-04 19:16
ohadp30-Mar-04 19:16 
GeneralRe: Interesting problems Pin
FlyingDancer30-Mar-04 21:39
FlyingDancer30-Mar-04 21:39 
GeneralRe: Interesting problems Pin
Maxwell Chen30-Mar-04 22:20
Maxwell Chen30-Mar-04 22:20 
GeneralRe: Interesting problems Pin
Paul Ranson31-Mar-04 1:57
Paul Ranson31-Mar-04 1:57 
GeneralRe: Interesting problems Pin
FlyingDancer31-Mar-04 13:30
FlyingDancer31-Mar-04 13:30 
GeneralC to Visual C++.Net Pin
gyrogearloose30-Mar-04 15:04
gyrogearloose30-Mar-04 15:04 
GeneralRe: C to Visual C++.Net Pin
Christian Graus30-Mar-04 15:14
protectorChristian Graus30-Mar-04 15:14 
GeneralRe: C to Visual C++.Net Pin
Maxwell Chen30-Mar-04 15:37
Maxwell Chen30-Mar-04 15:37 
GeneralRe: C to Visual C++.Net Pin
Christian Graus30-Mar-04 15:38
protectorChristian Graus30-Mar-04 15:38 
GeneralRe: C to Visual C++.Net Pin
Maxwell Chen30-Mar-04 15:46
Maxwell Chen30-Mar-04 15:46 
GeneralRe: C to Visual C++.Net Pin
gyrogearloose31-Mar-04 13:23
gyrogearloose31-Mar-04 13:23 
GeneralRe: C to Visual C++.Net Pin
gyrogearloose31-Mar-04 14:03
gyrogearloose31-Mar-04 14:03 
GeneralCImageList serialization under XP and NT Pin
Heywood30-Mar-04 13:41
Heywood30-Mar-04 13:41 
GeneralRe: CImageList serialization under XP and NT Pin
Michael Dunn30-Mar-04 14:47
sitebuilderMichael Dunn30-Mar-04 14:47 
QuestionWinXP : how to hide my console-app from the taskbar ? Pin
L.Denninger30-Mar-04 11:43
L.Denninger30-Mar-04 11:43 

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.