forcing tabs in regex

2018-02-27 Thread dark777 via Digitalmars-d-learn

Regex validates years bisexto and not bisextos in format:
const std::regex 
pattern(R"(^(?:(?:(0?[1-9]|1\d|2[0-8])([-/.])(0?[1-9]|1[0-2]|[Jj](?:an|u[nl])|[Mm]a[ry]|[Aa](?:pr|ug)|[Ss]ep|[Oo]ct|[Nn]ov|[Dd]ec|[Ff]eb)|(29|30)([-/.])(0?[13-9]|1[0-2]|[Jj](?:an|u[nl])|[Mm]a[ry]|[Aa](?:pr|ug)|[Ss]ep|[Oo]ct|[Nn]ov|[Dd]ec)|(31)([-/.])(0?[13578]|1[02]|[Jj]an|[Mm]a[ry]|[Jj]ul|[Aa]ug|[Oo]ct|[Dd]ec))(?:\2|\5|\8)(0{2,3}[1-9]|0{1,2}[1-9]\d|0?[1-9]\d{2}|[1-9]\d{3})|(29)([-/.])(0?2|[Ff]eb)\12(\d{1,2}(?:0[48]|[2468][048]|[13579][26])|(?:0?[48]|[13579][26]|[2468][048])00))$)");


this regex above validates the formats through backreferences.

dd-mm- ou dd-str- ou dd-Str-
dd/mm/ ou dd/str/ ou dd/Str/
dd.mm. ou dd.str. ou dd.Str.



Regex validates years bisexto and not bisextos in format:
const std::regex 
pattern(R"(^(?:\d{4}([-/.])(?:(?:(?:(?:0?[13578]|1[02]|[Jj](?:an|ul)|[Mm]a[ry]|[Aa]ug|[Oo]ct|[Dd]ec)([-/.])(?:0?[1-9]|[1-2][0-9]|3[01]))|(?:(?:0?[469]|11|[Aa]pr|[Jj]un|[Ss]ep|[Nn]ov)([-/.])(?:0?[1-9]|[1-2][0-9]|30))|(?:(0?2|[Ff]eb)([-/.])(?:0?[1-9]|1[0-9]|2[0-8]|(?:(?:\d{2}(?:0[48]|[2468][048]|[13579][26]))|(?:(?:[02468][048])|[13579][26])00)([-/.])(0?2|[Ff]eb)([-/.])29)$)");


this regex above had to validate the formats through 
backreferences.


but it is validating in the following formats
-mm/dd ou -str/dd ou -Str/dd
/mm.dd ou /str.dd ou /Str.dd
.mm-dd ou .str-dd ou .Str-dd


when it had to validate only in the following formats
-mm-dd ou -str-dd ou -Str-dd
/mm/dd ou /str/dd ou /Str/dd
.mm.dd ou .str.dd ou .Str.dd

how do I do it validate only with some of the tabs?




Digital mars QT interface?

2017-12-29 Thread dark777 via Digitalmars-d-learn
I would like to know if there is any repository that uses QT to 
create QT creator-style programs with buttons and combobox cute?


Re: overload

2017-12-15 Thread dark777 via Digitalmars-d-learn

On Friday, 15 December 2017 at 08:57:23 UTC, Biotronic wrote:

On Thursday, 14 December 2017 at 22:47:15 UTC, dark777 wrote:
I know that this community is not from c ++, but for some time 
I studied how to do overload of ostream operators in c ++ and 
I even managed to get to this result, I got to this result in 
another post done here but I did not understand the that it 
returns this error below:



bin2.cxx:44:43: error: expected ‘,’ or ‘...’ before ‘(’ token
   std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

   ^
bin2.cxx: In member function ‘std::ostream& 
BinStream::operator<<(std::ios_base&)’:

bin2.cxx:46:16: error: ‘_Pfn’ was not declared in this scope
return os <<_Pfn;


I expect it's confused by __cdecl. I just copied the function 
declaration from VS' iostreams, so it might be tainted by how 
VS does things. Removing __cdecl might work, or just add

#define __cdecl __attribute__((__cdecl__))
A third option is to replace `std::ios_base& (__cdecl 
*Pfn)(std::ios_base&)` with `decltype(std::hex)& Pfn`.


All of this said, I'd suggest finding a C++ forum to get 
answers to these questions. While I'm happy to help, it's not 
really the place for these discussions.


--
  Biotronic


I do not use windows I thought it was the standard of iostream 
ansi c++


overload

2017-12-14 Thread dark777 via Digitalmars-d-learn
I know that this community is not from c ++, but for some time I 
studied how to do overload of ostream operators in c ++ and I 
even managed to get to this result, I got to this result in 
another post done here but I did not understand the that it 
returns this error below:



bin2.cxx:44:43: error: expected ‘,’ or ‘...’ before ‘(’ token
   std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

   ^
bin2.cxx: In member function ‘std::ostream& 
BinStream::operator<<(std::ios_base&)’:

bin2.cxx:46:16: error: ‘_Pfn’ was not declared in this scope
return os <<_Pfn;

so that the output is the same as below:

127 em binario: 000111
127 em octal:   177
127 em binario: 000111
127 em hexadecimal: 7f
127 em decimal: 127
127 em binario: 000111

and not this:

127 em binario: 000111
127 em octal:   000111
127 em binario: 000111
127 em hexadecimal: 000111
127 em decimal: 000111
127 em binario: 000111


#include  //ios_base
#include 
#include// CHAR_BIT
#include 
#include  // reverse

struct BinStream
   {
 std::ostream& os;
 BinStream(std::ostream& os) : os(os) {}

 std::string binario(unsigned int n)
 {
  //converte numero para string de bits
  std::stringstream bitsInReverse;
  //int nBits = sizeof(n) * CHAR_BIT;
  unsigned int nBits = sizeof(n)*2.5;

  while (nBits-- > 0)
  {
   bitsInReverse << (n & 1);
   n >>= 1;
  }

  std::string bits(bitsInReverse.str());
  std::reverse(bits.begin(), bits.end());
  return bits;
 }

 template
 BinStream& operator<<(T&& value)
 {
 os << value;
 return *this;
 }

 BinStream& operator<<(int value)
 {
 os << binario(value);
 return *this;
 }

 std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

 {
 return os << _Pfn;
 }
 };

 struct Bin
 {
 friend BinStream operator<<(std::ostream& os, const Bin& 
f);

 } bin;

 BinStream operator<<(std::ostream& os, const Bin& f)
 {
 return BinStream(os);
 }

 int main()
 {
  std::cout << "\n\t127 em binario: " << binario(127)
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em octal:   " << std::oct << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em hexadecimal: " << std::hex << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em decimal: " << std::dec << 127
<< "\n\t127 em binario: " << bin << 127 << "\n\n";
 }



Re: operator overload

2017-12-12 Thread dark777 via Digitalmars-d-learn

On Tuesday, 12 December 2017 at 17:13:55 UTC, Biotronic wrote:

On Tuesday, 12 December 2017 at 16:54:17 UTC, Biotronic wrote:
There is no way in C++ to set the format the way you want it. 
If you want binary output, you need to call a function like 
your binario function.


Of course this is not entirely true - there is a way, but it's 
ugly and probably not what you want:


struct BinStream
{
std::ostream& os;
BinStream(std::ostream& os) : os(os) {}

template
BinStream& operator<<(T&& value)
{
os << value;
return *this;
}

BinStream& operator<<(int value)
{
os << binario(value);
return *this;
}

std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

{
return os << _Pfn;
}
};

struct Bin
{
friend BinStream operator<<(std::ostream& os, const 
Bin& f);

} bin;

BinStream operator<<(std::ostream& os, const Bin& f)
{
return BinStream(os);
}

int main()
{
std::cout << "\n\t127 em binario: " << binario(127)
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em octal:   " << std::oct << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em hexadecimal: " << std::hex << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em decimal: " << std::dec << 127
<< "\n\t127 em binario: " << bin << 127 << "\n\n";
}

What is this black magic? Instead of overriding how 
std::ostream does formatting, Bin::Operator<< now returns a 
wrapper around a std::ostream, which special cases ints. If it 
gets any other format specifiers, it returns the ostream again, 
and the binary formatting is gone.


All in all, I think the conclusion is: Stay with D.

--
  Biotronic


I tried to execute with this part of the code

  std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

  {
   return os <<_Pfn;
  }

and it returns me this error below what is the include?

bin2.cxx:44:43: error: expected ‘,’ or ‘...’ before ‘(’ token
   std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

   ^
bin2.cxx: In member function ‘std::ostream& 
BinStream::operator<<(std::ios_base&)’:

bin2.cxx:46:16: error: ‘_Pfn’ was not declared in this scope
return os <<_Pfn;


Re: operator overload

2017-12-12 Thread dark777 via Digitalmars-d-learn

On Tuesday, 12 December 2017 at 17:13:55 UTC, Biotronic wrote:

On Tuesday, 12 December 2017 at 16:54:17 UTC, Biotronic wrote:
There is no way in C++ to set the format the way you want it. 
If you want binary output, you need to call a function like 
your binario function.


Of course this is not entirely true - there is a way, but it's 
ugly and probably not what you want:


struct BinStream
{
std::ostream& os;
BinStream(std::ostream& os) : os(os) {}

template
BinStream& operator<<(T&& value)
{
os << value;
return *this;
}

BinStream& operator<<(int value)
{
os << binario(value);
return *this;
}

std::ostream& operator<<(std::ios_base& (__cdecl 
*_Pfn)(std::ios_base&))

{
return os << _Pfn;
}
};

struct Bin
{
friend BinStream operator<<(std::ostream& os, const 
Bin& f);

} bin;

BinStream operator<<(std::ostream& os, const Bin& f)
{
return BinStream(os);
}

int main()
{
std::cout << "\n\t127 em binario: " << binario(127)
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em octal:   " << std::oct << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em hexadecimal: " << std::hex << 127
<< "\n\t127 em binario: " << bin << 127
<< "\n\t127 em decimal: " << std::dec << 127
<< "\n\t127 em binario: " << bin << 127 << "\n\n";
}

What is this black magic? Instead of overriding how 
std::ostream does formatting, Bin::Operator<< now returns a 
wrapper around a std::ostream, which special cases ints. If it 
gets any other format specifiers, it returns the ostream again, 
and the binary formatting is gone.


All in all, I think the conclusion is: Stay with D.

--
  Biotronic


I understand is basically this now I will see the necessity of 
this basically the example I wanted to do is to understand how it 
would be done in the most correct way, now I will study to do 
other cases if nescessarios but primarily is to convert only 
integers but you did exactly the that I wanted


I did some studies in the D language and it already has a way to 
convert to binary without any work just using% b as in printf you 
use% X or% x to convert to exa ... and that was the reason that 
made me interested in understand this was looking at some older 
glibc and the way printf understands these very interesting 
conversion operators


operator overload

2017-12-12 Thread dark777 via Digitalmars-d-learn
I know that this community is not of c ++, but some time I have 
been studying how to do overload of ostream operators in c ++ and 
I even managed to get to this result but the same is not 
converting to binary only presents zeros as output to any number 
already tried to pass parameter of variable and yet he is not 
getting the number for conversion how to solve it so that it 
works correctly?


PS: if I use the same conversion algorithm in a function it 
converts normally it is not only converting to the output of the 
operator ..



https://pastebin.com/BXGXiiRk


Re: no print function output do while

2017-09-28 Thread dark777 via Digitalmars-d-learn

On Thursday, 28 September 2017 at 21:34:46 UTC, arturg wrote:
On Thursday, 28 September 2017 at 20:17:24 UTC, Ali Çehreli 
wrote:

On 09/28/2017 12:18 PM, dark777 wrote:
On Thursday, 28 September 2017 at 18:46:56 UTC, Ali Çehreli 
wrote:

On 09/28/2017 08:13 AM, dark777 wrote:

no print function output do while

in my program after entering the data and select the 
function that will print on the screen the same is not 
printing ..


and if I choose 'q' or 'Q' does the program not close what 
is happening?

should not it work just like in C ++?

https://pastebin.com/iiMVPk4x


You made a simple logic error. Change the following || to &&:

    }while(choice != 'q' || choice != 'Q');

Ali


I think it should not give this error

good but until now I do not understand why after I enter with 
data in the function add_human


the same is not printed when I choose the 'p' or 'P' option 
in the case


void print_list(Human[] human_list)
{
  foreach(human; human_list)
    {
     writefln("\nNome: %s",human.name);
     writefln("Peso: %0.2f",human.peso);
     writefln("Idade: %d\n",human.age);
    }
}


It's because add_human is appending to its own array. Change 
it to by-ref:


void add_human(ref Human[] human_list)

Ali


while(choice != 'q' || choice != 'Q');
doesn't seem to exit the loop, while this works:
while(choice != 'q');
or
while(!(choice == 'q' || choice == 'Q'));

wouldn't it be better to use a labeled statement instead?

endless : while(true)
{
...

switch(choice)
{
...

case 'Q':
case 'q': break endless;

...
}
}


It's good that it worked out here.


Re: no print function output do while

2017-09-28 Thread dark777 via Digitalmars-d-learn

On Thursday, 28 September 2017 at 18:46:56 UTC, Ali Çehreli wrote:

On 09/28/2017 08:13 AM, dark777 wrote:

no print function output do while

in my program after entering the data and select the function 
that will print on the screen the same is not printing ..


and if I choose 'q' or 'Q' does the program not close what is 
happening?

should not it work just like in C ++?

https://pastebin.com/iiMVPk4x


You made a simple logic error. Change the following || to &&:

}while(choice != 'q' || choice != 'Q');

Ali


I think it should not give this error

good but until now I do not understand why after I enter with 
data in the function add_human


the same is not printed when I choose the 'p' or 'P' option in 
the case


void print_list(Human[] human_list)
{
 foreach(human; human_list)
   {
writefln("\nNome: %s",human.name);
writefln("Peso: %0.2f",human.peso);
writefln("Idade: %d\n",human.age);
   }
}


no print function output do while

2017-09-28 Thread dark777 via Digitalmars-d-learn

no print function output do while

in my program after entering the data and select the function 
that will print on the screen the same is not printing ..


and if I choose 'q' or 'Q' does the program not close what is 
happening?

should not it work just like in C ++?

https://pastebin.com/iiMVPk4x


Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn

On Sunday, 24 September 2017 at 18:00:32 UTC, Adam D. Ruppe wrote:
I think readf("%s") reads everything available. readf(" %s\n") 
might help but personally, I say avoid readf.


Just use readln and to!int instead


auto line = readln();
if(line.length == 0)
   writeln("please enter a number");

age = to!int(line);


to is from import std.conv


I added \n and it worked.

I created a float variable and wanted to know how to read or 
print the same?


reading?

write ("Weight:");
   readf (" %ld\n", );

and

writefln ("Weight:% ld", human.peso);

but he returned me errors


Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn
On Sunday, 24 September 2017 at 17:05:11 UTC, Neia Neutuladh 
wrote:

On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote:

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.


Add a `writeln();` after reading input, maybe?


I changed the write by writeln and it still did not work, I added 
it after receiving the first entry and it did not work ...


Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn

On Sunday, 24 September 2017 at 15:51:01 UTC, dark777 wrote:

On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:

On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:

I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I 
press enter

how to solve this?


use writeln instead write


nothing to see hand

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.


nothing to see hand

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.


Re: Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn

On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:

On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:

I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I 
press enter

how to solve this?


use writeln instead write


nothing to see hand

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.


Struct List Human

2017-09-24 Thread dark777 via Digitalmars-d-learn

I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I 
press enter

how to solve this?


Re: erros em printf[AJUDA]

2017-09-08 Thread dark777 via Digitalmars-d-learn

On Friday, 8 September 2017 at 23:04:07 UTC, kinke wrote:

On Friday, 8 September 2017 at 22:30:16 UTC, dark777 wrote:
ex3.d(19): Error: cannot pass dynamic arrays to extern(C) 
vararg functions


printf("Writef Hello %.*s!\n", name.length, name.ptr);


puts por que é mais chato o printf aqui na linguagem D do que no 
C?


erros em printf[AJUDA]

2017-09-08 Thread dark777 via Digitalmars-d-learn
estava rodando este programa porem acrescentei o printf mas como 
resolver o erro?


bash-4.4$ rdmd ex3
ex3.d(19): Error: cannot pass dynamic arrays to extern(C) vararg 
functions

Failed: ["dmd", "-v", "-o-", "ex3.d", "-I."]


import std.stdio;
import std.string; //strip
import core.stdc.stdio;

//more informations: http://ddili.org/ders/d.en/strings.html

void main()
{
//char[] name;


write("What is your name? ");
//readln(name); //acept vector de char on input readln
//name = strip(name);  //Hello String!← no new-line 
character


string name = readln().strip(); // read string and no new 
line strip


write("Write Hello ", name, "!\n");
printf("Writef Hello %s!\n", name);
writef("Writef Hello %s!\n", name);
writeln("Writeln Hello ", name, "!");
writefln("Writefln Hello %s!", name);
}


Re: D is Multiplatform[DUVIDA]

2017-09-07 Thread dark777 via Digitalmars-d-learn
On Friday, 8 September 2017 at 03:56:25 UTC, rikki cattermole 
wrote:

On 08/09/2017 3:08 AM, dark777 wrote:
On Friday, 8 September 2017 at 00:09:08 UTC, solidstate1991 
wrote:

On Thursday, 7 September 2017 at 23:58:05 UTC, dark777 wrote:
Good night, did you want to know this? Is the DE language 
cross-platform or cross-compile like C ++?


GDC and LDC has multi-platform support, I'm currently working 
on an ARM backend for DMD.


so does it mean that if I develop a program using the D 
language in BSD creating generic resources for example and 
compiling on windows, linux and darwin it would work fine?


Each platform has its own unique behavior and related code.
Gotta try it to know for certain.

But that is unrelated to D in the most part :)


but in any case then the D language can be considered 
multiplatform?


Re: D is Multiplatform[DUVIDA]

2017-09-07 Thread dark777 via Digitalmars-d-learn

On Friday, 8 September 2017 at 00:09:08 UTC, solidstate1991 wrote:

On Thursday, 7 September 2017 at 23:58:05 UTC, dark777 wrote:
Good night, did you want to know this? Is the DE language 
cross-platform or cross-compile like C ++?


GDC and LDC has multi-platform support, I'm currently working 
on an ARM backend for DMD.


so does it mean that if I develop a program using the D language 
in BSD creating generic resources for example and compiling on 
windows, linux and darwin it would work fine?


D is Multiplatform[DUVIDA]

2017-09-07 Thread dark777 via Digitalmars-d-learn
Good night, did you want to know this? Is the DE language 
cross-platform or cross-compile like C ++?


Re: Adding deprecated to an enum member

2017-07-31 Thread dark777 via Digitalmars-d-learn

On Tuesday, 1 August 2017 at 01:12:28 UTC, Jeremy DeHaan wrote:
I got an error today because I added deprecated to an enum 
member.


Is there a way to achieve this, or am I out of luck? If it 
isn't doable, should it be?


Here's what I want:

enum PrimitiveType
{
Points,
Lines,
LineStrip,
Triangles,
TriangleStrip,
TriangleFan,
Quads,

deprecated("Use LineStrip instead.")
LinesStrip = LineStrip,
deprecated("Use TriangleStrip instead.")
TrianglesStrip = TriangleStrip,
deprecated("Use TriangleFan instead.")
TrianglesFan   = TriangleFan
}


PrimitiveType ptype = LinesStrip; //error, Use LineStrip 
instead.


I did as follows using deprecated may help you to elucidate in 
relation to this

https://pastebin.com/NEHtWiGx


Csharp para Digital Mars D[AJUDA]

2017-07-24 Thread dark777 via Digitalmars-d-learn
Eu tenho um projeto em windows form C# feito no virual studio um 
amigo meu e eu criamos para a semana academica ele faz cadastros 
e marca a presença das visitas na semana por um id de quem ja 
pagou pelas palestras queria portar ele para D.


Que biblioteca para forms vcs me recomendam para desenvolver o 
mesmo?


o que eu teria que dar mais atenção em Csharp para portar para a 
linguagem D?



PS: ele é desktop mas faz redirecionamento para um banco de dados 
mysql para salvar os dados direto no servidor...


Re: criando modulos em D para classe pessoa[AJUDA]

2017-07-24 Thread dark777 via Digitalmars-d-learn

On Monday, 24 July 2017 at 20:33:42 UTC, dark777 wrote:

On Monday, 24 July 2017 at 20:06:37 UTC, ag0aep6g wrote:

On 07/24/2017 09:45 PM, dark777 wrote:
principal.d(18): Error: octal literals 01023040 are no longer 
supported, use std.conv.octal!1023040 instead

Failed: ["dmd", "-v", "-o-", "principal.d", "-I."]

[...]

https://pastebin.com/CYinHWyQ


From there:

e = new Endereco();
e.setCidade("São Paulo");
e.setCEP(01023040);


Google's translator says (from Portuguese):
Endereco = address,
Cidade = City,
CEP = ZIP code.

Don't store ZIP codes as numbers. Store them as strings. 
Leading zeroes have meaning in ZIP codes. You don't do math on 
ZIP codes.


deu certo aqui agora valeu ai..



Eu tenho um projeto em windows form C# feito no virual studio um 
amigo meu e eu criamos para a semana academica ele faz cadastros 
e marca a presença das visitas na semana por um id de quem ja 
pagou pelas palestras queria portar ele para D. que biblioteca 
para forms vcs me recomendam para desenvolver o mesmo? PS: ele é 
desktop mas faz redirecionamento para um banco de dados mysql 
para salvar os dados direto no servidor...


Re: criando modulos em D para classe pessoa[AJUDA]

2017-07-24 Thread dark777 via Digitalmars-d-learn

On Monday, 24 July 2017 at 20:06:37 UTC, ag0aep6g wrote:

On 07/24/2017 09:45 PM, dark777 wrote:
principal.d(18): Error: octal literals 01023040 are no longer 
supported, use std.conv.octal!1023040 instead

Failed: ["dmd", "-v", "-o-", "principal.d", "-I."]

[...]

https://pastebin.com/CYinHWyQ


From there:

e = new Endereco();
e.setCidade("São Paulo");
e.setCEP(01023040);


Google's translator says (from Portuguese):
Endereco = address,
Cidade = City,
CEP = ZIP code.

Don't store ZIP codes as numbers. Store them as strings. 
Leading zeroes have meaning in ZIP codes. You don't do math on 
ZIP codes.


deu certo aqui agora valeu ai..


criando modulos em D para classe pessoa[AJUDA]

2017-07-24 Thread dark777 via Digitalmars-d-learn
pessoal eu tenho umas classes java e estava portando para D e 
para usar as importaçoes criei os modules nescessarios todos 
estao dentro da mesma pasta porem ao fazer:


$rdmd principal

ele retorna o seguinte erro:

principal.d(18): Error: octal literals 01023040 are no longer 
supported, use std.conv.octal!1023040 instead

Failed: ["dmd", "-v", "-o-", "principal.d", "-I."]


Os codigos sao os que estao abaixo no pastebin

https://pastebin.com/CYinHWyQ


Re: char e string em linguagem D

2017-07-13 Thread dark777 via Digitalmars-d-learn

On Thursday, 13 July 2017 at 22:30:29 UTC, crimaniak wrote:

On Thursday, 13 July 2017 at 21:49:40 UTC, dark777 wrote:

Pessoal eu fiz o seguinte programa em C++.

https://pastebin.com/CvVv6Spn

porem tentei fazer o equivalente em D mas nao entendi muito 
bem...


https://pastebin.com/2xw9geRR

alguem poderia me ajudar?


Se acepta utilizar intervalos en lugar de punteros desnudos. 
(Hola, soy traductor de google)


import std.stdio, std.string;

//https://www.vivaolinux.com.br/script/GNU-que-bacana

class GnuQueBacana
{
   this(){}

  char[] stalman()
  {
  return cast(char[])`
  ((__-^^-,-^^-__))
   *---***---*
*--|o   o|--*
   \ /
): :(
(o_o)
  -
 https://www.gnu.org

`;
  }

  char[] torvald()
  {
  return cast(char[])`
#
   ###
   ##O#O##
   ###
   ##\#/##
#lll##
   #l##
   #l###
   #####
  OOO#ll#OOO
 OO#ll#OO
OOO#ll#OOO
 OOO##OOO
https://www.kernel.org

`;
  }

  string stallman()
  {
  return `
  ((__-^^-,-^^-__))
   *---***---*
*--|o   o|--*
   \ /
): :(
(o_o)
  -
 https://www.gnu.org

`;
  }

  string torvalds()
  {
  return `
#
   ###
   ##O#O##
   ###
   ##\#/##
#lll##
   #l##
   #l###
   #####
  OOO#ll#OOO
 OO#ll#OO
OOO#ll#OOO
 OOO##OOO
https://www.kernel.org

`;
  }

};

void main()
{
  GnuQueBacana gnu = new GnuQueBacana();

  writeln(gnu.stalman(), gnu.torvald(), gnu.stallman(), 
gnu.torvalds());

}


muito massa nao achei que era tao simples assim..


char e string em linguagem D

2017-07-13 Thread dark777 via Digitalmars-d-learn

Pessoal eu fiz o seguinte programa em C++.

https://pastebin.com/CvVv6Spn

porem tentei fazer o equivalente em D mas nao entendi muito bem...

https://pastebin.com/2xw9geRR

alguem poderia me ajudar?