|
I succeeded with
CStringA . Thank you all of you !
|
|
|
|
|
Hi,
The CStringA class has an operator LPCTSTR which means you should be able to use it with cout. There is also a CString::GetBuffer().
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: The CStringA class has an operator LPCTSTR
Just a small clarification: CStringA class has an operator LPCSTR. 
|
|
|
|
|
Yep,
I always disliked the TCHAR hacks. Although I do still find myself using the L and _T macros for string literals.
Btw, I met you some years ago at one of the restaurants after the mvp summit. I think you were the only guy not drinking alcohol if I remember correctly.
Best Wishes,
-David Delaune
|
|
|
|
|
|
Ok, it would have been at the Submixer[^] which is at the commons area. I went out of my way to make it there in the evenings just to see some of the people from the online forums.
Actually now that I think about it, it was probably Marius Bancila. In my mind I've always had both you guys organized as the "Codeguru mvps".
Best Wishes,
-David Delaune
|
|
|
|
|
|
I'm trying to see if I can embed a CFileDialog to a CPropertyPage.
I stumbled on this question with a minimalist answer (I've asked there also) : Re: CFileDialog in CPropertySheet - C / C++ / MFC Discussion Boards
The id IDD_FILEOPEN_EX does not exists, can I replace it with AFX_IDD_FILEOPEN ? (there's not seems to be a IDD_FILEOPEN id ).
also,
If I need to include dlgs.h to have access to the id stc32, do I need to include an additional RC file somewhere.
Or, is there a more modern way of doing this ?
Thanks.
I'd rather be phishing!
|
|
|
|
|
The AFX_IDD_FILEOPEN is defined in afxres.h that is by default #incuded in your resource.h file.
|
|
|
|
|
Hi everyone . I am a newbie in programming , so i would be very grateful if you could help me . I have to implement the Blum Blum Shub in C or C++ using the stdlib.h and time.h libraries . Can anyone help me with this ?
Thanks 
|
|
|
|
|
And what exactly is your problem?
|
|
|
|
|
I have to create a random number generator Blum Blum Shub in C or C++ ,using libraries stlib.h and time.h
|
|
|
|
|
|
Maybe take a look at this article. CBBS: A Pseudo Random Number Generator[^]
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
I already took a look at him but i need not a so complex code , only a simple version with these two libraries that i mentioned.
|
|
|
|
|
|
And time.h how to use in it?
|
|
|
|
|
No idea, because we do not have the instructions that your teacher gave you. If you read the documentation for the random and time functions (time, _time32, _time64 | Microsoft Docs[^]) you should be able to decide how they can help you.
|
|
|
|
|
Here's the full indications that i have :
Purpose: to develop a function that generates random numbers from
a given range.
Elaboration of the module for generating random numbers
Resources :
C or C++ compiler
stdlib.h and time.h libraries
Algorithm Blum Blum Shub
Hope it helps in any kind
|
|
|
|
|
So, you have all the information you need, time to get started. If you were under the mistaken impression that someone here was going to do your work for you ...
|
|
|
|
|
You are not asking a specific question. You are essentially asking someone to do all the work for you, which will not happen.
Get started on it and if you get stuck on something specific then come back and show where you are stuck and someone will be glad to help.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Member 14956475 wrote: I have to implement the Blum Blum Shub in C or C++... More importantly, can you do it with pencil and paper? If the answer is no, then: 1) you are going to be hard pressed to implement it in code, and 2) you should work on it until you can produce results on paper. Don't let computer code take the place of the basic understanding of algorithms.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Okay , this is the code that i managed to do :
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
const int p = 30000000091;
const int q = 40000000003;
int N ;
scanf("%i", &N);
const unsigned long long int s = 1200000003730000000273;
unsigned int i,M,x[N];
time_t t;
srand((unsigned) time(&t));
M=p*q;
i=0;
x[0]=s;
for(i=1;i<=N;i++){
x[i]=(x[i-1]*x[i-1])%M;
}
for(i=1;i<=N;i++){
printf(" x[%d] = %d\n",i,x[i]);
}
system("PAUSE");
return 0;
}
I have some issues with it , first it's that i need to add from console the biggest number D and i dont know how to put it in as now it's generating numbers without upper limit . Also can anyone tell me how to fix the code as it generates the same numbers at some intervals , if you have other remarks on how to make it better tell me please . Thanks
|
|
|
|
|
I found at least one issue with the code:
You're using the variable N before you initialize it with a value. This is a no no.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Member 14956475 wrote: ...i need to add from console the biggest number D and i dont know how to put it in as now it's generating numbers without upper limit . Change your main() signature to:
void main( int argc, char *argv[] ) Then access argv[1] to get D as a command line argument.
Also, your two for() loops are accessing beyond the end of the x array. In C, arrays start at 0 .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|