|
what are the values of 'l' and 's', when you hit this line:
return l/s;
|
|
|
|
|
I think you should check address of pointer and length of array
|
|
|
|
|
I have checked on visual studio 2010 , you can check again
#include <iostream>
#include <stdio.h>
using namespace std;
long double Harmonique(long double *t,int l)
{
long double s=0.0;
for(int i=0; i<l; i++)
{
if(*t == 0)
{
printf("error!!!");
s +=1.0/(1+(*t));
}
else
{
s +=1.0/(*t);
}
t++ ;
}
return l/s;
}
int main()
{
long double arr[] ={1,5,5,7,43};
long double temp = Harmonique(arr ,5);
cout << temp <<endl;
return 0;
}
3.19262
Press any key to continue . . .
Thanks
Thong Le Trung
|
|
|
|
|
Here, I found the solution. the * t I used in "main" was of type int, so there was a problem of division by zero.
thank you for example and help.
|
|
|
|
|
I am sorry , I see error for you .
I have a example , i hope this example will help you.
What will be output of the following program?
#include<stdio.h>
int main(){
float a=0.7;d
if(a<0.7){
printf("C");
}
else{
printf("C++");
}
return 0;
}
EXPLANATION
Output:
Turbo C++ 3.0: c
Turbo C ++4.5: c
Linux GCC: c
Visual C++: c
Explanation:
0.7 is double constant (Default). Its binary value is written in 64 bit.
Binary value of 0.7 = (0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011 )
Now here variable a is a floating point variable while 0.7 is double constant. So variable a will contain only 32 bit value i.e.
a = 0.1011 0011 0011 0011 0011 0011 0011 0011 while
0.7 = 0.1011 0011 0011 0011 0011 0011 0011 0011 0011 0011 0011....
It is obvious a < 0.7
|
|
|
|
|
|
Hi ,all,
When I open a .txt file .I think Notepad will call NtReadFile function .
If I modify content .txt file and then I save txt file . I think
Notepad will call Notepad will call NtWriteFile function .
My question :
When I open .txt file ,and next I choose "save as" .
How many functions does Notepad call to be "save as" ?
Will Data store on buffer or hard disc before we choose "save as "?
How many functions does "Microsoft Word" call when we choose "save as" ?
I think in the case "Microsoft Word" will use memory mapped file to be " save as"
Thanks
Thong Le Trung
modified 16-Aug-13 5:26am.
|
|
|
|
|
It will call NtCreeateFile to change the name. As for the file itself, it will be in memoery generally unless it is so big it gets paged out or read in in chunks.
|
|
|
|
|
Hi,Erudite_Eric,
Before I write data , I will hook NtWriteFile function and encrypt content file .
Before I read data , I will hook NtReadFile function and decrypt content file to display file
My code work well with "Notepad" , but crash with "Microsoft Word" when I choose "save as"
I have checked .pdf file , .pdf file still works well .
Thank you for your time.
Thong Le Trung.
|
|
|
|
|
Well obviously I cant say why your application is crashing.
|
|
|
|
|
Function NtCreateFile will call to change the name when we choose "save as" .
Do I wonder content new file will have from ? .
I think after create new file, it will read File from old file and then it will write data to new file.
|
|
|
|
|
No, it wont do that. The kernel API does exactly what it says it does. If it says it create a file it does, it doesnt copy a file.
Believe me, I have spent 16 years writing windows kernel code.
--edit--
Oh look a one voter. Well, NtCreateFIle etc is the API you use inside the kernel and I have used it a lot. so mr one voter, ypu are wrong.
--edit--
Oh look, another 1 voter. What fun!
modified 20-Aug-13 8:50am.
|
|
|
|
|
Hi, Erudite ,
I graduated about one year so I don't have much experience about Win kernel .Thank you for helping me
Thong Le Trung
|
|
|
|
|
Hi I created 3 views on a view to make it like Windows Explore. I did not used CSplitterWnd class to split instaed created seperate on a view.
I need to make these view resizable, how can I do it?
|
|
|
|
|
Hi.
But that's exactly what a splitter is for. I don't understand why you wouldn't use it.
You can handle resize-events of the frame/dialog easily enough to layout the 3 children windows. But re-writing code to handle individually resizing them wouldn't be my idea of a nice way to round-off the week.
Is there any reason that you can't use a splitter window?
"Science adjusts its views based on what's observed. Faith is the denial of observation, so that belief can be preserved." - Tim Minchin
|
|
|
|
|
|
I am trying to builld my application using VS2008 but getting error "cannot open program database vc90.pdb". I tried to deleted debug folder manually but getting same error.
Can you please help m to build?
|
|
|
|
|
|
<pre lang="Is it my old IDE or by design that static library with MFC support wizard will add only "generic class" and not MFC classes? "></pre>
|
|
|
|
|
What does that mean, and what does it have to do with C++?
Use the best guess
|
|
|
|
|
Whats the name of this forum?
|
|
|
|
|
Do you understand the OP's question?
Use the best guess
|
|
|
|
|
Did you? It is clearly an MFC question.
|
|
|
|
|
On the contrary, it's not clearly anything.
Use the best guess
|
|
|
|
|
MFC is about all there is that is clear though.
|
|
|
|