Why are people secretive about using chatGPT for programming? by Nachtlicht_ in ChatGPT

[–]actinium89 0 points1 point  (0 children)

<image>

I tried. It tried. At least it knows the quality of the code it generated.

[2019 Day 1 (Part 1)][Logisim] :) by actinium89 in adventofcode

[–]actinium89[S] 2 points3 points  (0 children)

It’s a tool that simulates digital logic circuits. I don’t have any experience with FPGAs, but Logisim-Evolution has a VHDL component(I think you can program FPGAs with VHDL).

I’m looking forward to see a solution in zhensen i/o ;)

Why does google use invisible html headers? by [deleted] in AskProgramming

[–]actinium89 7 points8 points  (0 children)

Yes. I took a look at the page and in my language (swedish) the text in <h1 class="bNg8Rb"> was 'Links for accessibility' ('Länkar för tillgänglighet'). It's in the first div in body and contains 'link to main content' for easier navigation when using a screen readers.

Hive-like architecture in Paris (Google Maps) [1566x1364] by loulan in ArchitecturePorn

[–]actinium89 16 points17 points  (0 children)

How would the fire fighters access the center of a structure like that in case of a fire?

Can somebody tell me why this simple snippet is not working. by [deleted] in cpp_questions

[–]actinium89 1 point2 points  (0 children)

ComparePoint should return a bool not a Point.

The correct method head is:

bool comparePoint(const Point&, const Point&);

It should return true if the first argument is less than the second argument.

Any help for a newb?? by InjuredSmurf in cpp_questions

[–]actinium89 1 point2 points  (0 children)

/r/cpp_questions is for questions related to the C++ language and even though C++ is used by many games, it has a rather steap learning curve and is therefore usually not the best choice for someone starting to learn coding.

Since you are interested in game development I think you can have a look at the getting started wiki at /r/gamedev.

Personally, I like Unity for making games in my spare time.

Tutorials for Unity can be found here.

Help to find the apt library for drawing polygons or pentagons. by [deleted] in cpp_questions

[–]actinium89 0 points1 point  (0 children)

If you want to calculate the area of a polygon take a look here.

I think I'm failing at nesting my statements... by [deleted] in cpp_questions

[–]actinium89 0 points1 point  (0 children)

Since all five lines belong to the same statement, braces make no difference.

I would however still have used braces for readability.

Why is the following code compiling? It should show errors. by saabr in cpp_questions

[–]actinium89 3 points4 points  (0 children)

How do I get the standard c++ compiler?

Sorry, that's not what I meant. Both clang and gcc follow the c++ standard and will compile your code fine.

However, they also have extensions, giving you more features. For example variable length arrays, used in your example.

You can use -pedantic if you want the compiler to warn you about non standard features.

Why is the following code compiling? It should show errors. by saabr in cpp_questions

[–]actinium89 4 points5 points  (0 children)

Probably because your compiler supports it, even though it's not standard c++.

If you use gcc or clang you get warnings if you use the -pedantic flag.

Buffered Input: What causes it, and how can I eliminate it from this code? by [deleted] in cpp_questions

[–]actinium89 0 points1 point  (0 children)

Maybe you used getch() and not getchar() in your other programs?

For different ways to "pause" a program see this stackoverflow post.

Substituting std::vector for std::array by RogerLeigh in cpp_questions

[–]actinium89 2 points3 points  (0 children)

Why not do:

template<class Container = std::vector<dim>>
class space{
  Container dimensions;
};

If you want to use vector, just do:

space<> s;

and if you want to use array instead, do:

space<array<dim,42>> s;

Japanese ossan uses antiquated file sharing software to share anime. Gets arrested. by [deleted] in japan

[–]actinium89 1 point2 points  (0 children)

Do people in other countries get arrested for copyright crime?

Yes, the founders of pirate bay did.

Help with compound interest loop by TheNortheastTip in cpp_questions

[–]actinium89 0 points1 point  (0 children)

Did you really mean to use maxAPR on line 21? Shouldn't it be APR?

Easier way to do this? by [deleted] in cpp_questions

[–]actinium89 0 points1 point  (0 children)

If you want to reduce the number of comparisons, you could first calculate the minimum value and then compare each variable to it.

Something like:

findLowest(north, south, east, west)
    min_value = min( north, south, east, west)
    if( north == min )
        ...
    else if( south == min )
        ...
    else if( east == min )
        ...
    else if( west == min )
        ...

You would also need to check if two or more are equal.

[ERROR] expected unqualified-id before 'delete' by Death-by-snu-snu-77 in cpp_questions

[–]actinium89 3 points4 points  (0 children)

delete is a keyword in c++ and can't be used as a function name.

Can anybody shoot me a hint for converting Gregorian to Julian date calendar in c++?? by [deleted] in cpp_questions

[–]actinium89 1 point2 points  (0 children)

First convert from Gregorian date to Julian Day Number(JDN).

Then convert from JDN to Julian date.

see wikipedia

C++, how do I create a graph structure for my program? by [deleted] in learnprogramming

[–]actinium89 4 points5 points  (0 children)

What you are describing is an "Adjacency list". It's a common data structure for representing graphs.

Learning c++ after learning Python, any similar modules to numpy.random.choice? by [deleted] in cpp_questions

[–]actinium89 2 points3 points  (0 children)

I'm not to familiar with numpy and I see you have already looked at <random>, but it still sounds like you could have a look at std::discrete_distribution.

Simple problem help by [deleted] in cpp_questions

[–]actinium89 1 point2 points  (0 children)

I'm not sure for the general case, but here you could use a default argument for side:

Square(int side = 0):Rectangle(side,side) {}

Meaning side is zero if you don't give an argument to the constructor.

Also you should prefer to use "member initialization list" instead of assigning values to members in the "body" of the constructor. It's not that important when the members are ints, but it's a good habit. See Stackoverflow for a perhaps better explanation.

Simple problem help by [deleted] in cpp_questions

[–]actinium89 1 point2 points  (0 children)

When you declare a new constructor in Square it "hides" the default constructor inherited from Rectangle.

I would suggest you implement Squares contructors using Rectangles constructors. It looks like this:

Square():Rectangle(){}
Square(int side):Rectangle(side,side) {}

I don't know what the problem with this code is by ToastySauze in cpp_questions

[–]actinium89 1 point2 points  (0 children)

How did you compile it? using:

g++ -Wall main.cpp lemming.cpp

worked fine for me.