Friday, June 2, 2017

Digest for comp.lang.c++@googlegroups.com - 7 updates in 6 topics

"Chris M. Thomasson" <invalid@invalid.invalid>: Jun 02 03:53PM -0700

On 4/12/2017 9:51 PM, Chris M. Thomasson wrote:
> loading data, it raises z back up through the root chain. Loading needs
> the complex number, the origin number (for termination), and the correct
> power, and it can recreate the stored data.
 
[...]
 
Fwiw, here is a crude little c++11 program that can save and load
ciphertext created by the n-ary complex storage encryption:
______________________________________
#include <complex>
#include <cstdlib>
#include <cstdio>
#include <iostream>
 
#define CT_PREC ".13"
#define CT_OFL "%" CT_PREC "lf"
typedef std::complex<double> ct_complex;
 
 
void
ct_load_ctxt(
FILE* in_file,
ct_complex* buf,
size_t buf_size
) {
printf("LOAD:\n");
 
for (size_t i = 0; i < buf_size; ++i)
{
double real_part = 0;
double imag_part = 0;
 
int r = fscanf(in_file, "(%lf, %lf) ", &real_part, &imag_part);
if (r != 2) break;
 
buf[i].real(real_part);
buf[i].imag(imag_part);
 
printf("%lu:(" CT_OFL ", " CT_OFL ")\n",
(unsigned long)i, buf[i].real(), buf[i].imag());
}
}
 
void
ct_store_ctxt(
FILE* out_file,
ct_complex* buf,
size_t buf_size
) {
printf("STORE:\n");
 
for (size_t i = 0; i < buf_size; ++i)
{
fprintf(out_file,
"(" CT_OFL ", " CT_OFL ") ", buf[i].real(), buf[i].imag());
 
printf("%lu:(" CT_OFL ", " CT_OFL ")\n",
(unsigned long)i, buf[i].real(), buf[i].imag());
}
}
 
 
int main(void)
{
char const* in_file = "ctxt.bin";
 
ct_complex ct[] = {
{ -2.123, 4.56789 },
{ -1, 1.2512300123 },
{ -0, 2.5678987654321 },
{ -1, 1.25 },
{ -2, 0 },
{ 1.234, 5.67891011 }
};
 
size_t ct_size = sizeof(ct) / sizeof(ct_complex);
 
 
// STORE
{
char const* out_file = in_file;
 
FILE* fout = fopen(out_file, "w");
 
ct_store_ctxt(fout, ct, ct_size);
 
fclose(fout);
}
 
printf("________________________________\n");
 
// LOAD
{
FILE* fin = fopen(in_file, "r");
 
ct_load_ctxt(fin, ct, ct_size);
 
fclose(fin);
}
 
return 0;
}
______________________________________
 
Can you notice any problems?
 
Thanks.
woodbrian77@gmail.com: Jun 02 01:30PM -0700

On Thursday, May 4, 2017 at 4:22:32 PM UTC-5, Mr Flibble wrote:
> >> the same type: "city".
 
> > This compiles:
 
> Just because code compiles it doesn't mean code is correct.
 
Right.
 
I'm still available for this.
 
 
Brian
Ebenezer Enterprises - "The end of a matter is better than its beginning,
and patience is better than pride." Ecclesiastes 7:8
 
http://webEbenezer.net
"Öö Tiib" <ootiib@hot.ee>: Jun 02 03:29AM -0700

> http://www.axiom-developer.org/
> Can you show a little function it is better to write in C++ than in Axiom?
 
You seem confused. That Axiom is not programming language.

It is computer algebra system (CAS). Most CAS are open source:
https://en.wikipedia.org/wiki/List_of_computer_algebra_systems
 
If you want to discuss C++ code then discuss the code of ones that
are written in C++. Axiom was written in LIsp.
asetofsymbols@gmail.com: Jun 02 06:51AM -0700

It is one programming language
one can write functions and them have results as in every language...
David Brown <david.brown@hesbynett.no>: Jun 02 01:37PM +0200

On 01/06/17 19:40, Mr Flibble wrote:
> On 01/06/2017 08:27, David Brown wrote:
<snip>
 
> So you are not forced to use inheritance if you want full event
> information but the idea is still to create new events appropriate for
> new widget abstractions.
 
That sounds fair enough. Your widgets have all the standard events,
like most toolkits, and you need to make your own classes if you want to
add additional event types.
 
>> if the user writes:
 
>> button1.events.clicked([]...)
 
> Sorry not sure about this idea or what it achieves.
 
The idea is to have the commonly used features conveniently available,
while less common features are "packed away" one level deeper. Think of
it like the options screen of an application, where there is a button
labelled "advanced" that hides the complicated stuff most people don't need.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Jun 02 05:44AM

On Thu, 2017-06-01, Rick C. Hodgin wrote:
>> My name is Thu Ra from Myanmar(Burma). I want to learn programming.
>> Please, teach me. Thank you.
 
> If you would like to learn C and some C++, I can teach you.
 
I /do/ like C, but I don't think it's the right way to
learn C++.
 
> If you want to learn everything in C++ it's beyond my knowledge
> base.
 
Mine too. But trying to learn everything would also be a mistake.
 
> But if you learn C and some C++, you can do 90% of C++ development
> until a few years ago.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Jun 01 06:45PM -0700

On Thursday, June 1, 2017 at 3:00:58 PM UTC-4, rami18 wrote:
> Hello,
 
> Sorry , i have posted in the wrong group.
 
You're posting through Google Groups I believe, Amine. Did you
know there's a "Delete Post" option in the down-arrow drop-down
in the upper-right of each post you make on this group?
 
Thank you,
Rick C. Hodgin
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: