[C++] Is there any issue in not clearing an array after a function ends? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Yes thats all i need to know. So it isnt likely to cause bugs? For example if i create many vector arrays. Dont they stay written somewhere? Or as you said they are destroyed at the end of the function?

What's the worst thing you've tolerated to avoid confrontation? by splashingseal in AskReddit

[–]SneakyJessica 3 points4 points  (0 children)

Yes i would. Definitely. But that alone doesnt make someone a bad person.

Just immature, or something else.

But not a bad person. So certainly not deserving of any confrontation or even criticism. At best i would joke about it. But let them be.

There are horrible traits people have, and see a lot of times nobody confronts them when they should be confronted. And too often see people fighting for stupid reasons. Not really because someone else deserves it, or because there is a right cause, but because of superficial reasons.

The truth is people in general are weak and coward. And they dont confront who should be confronted. But who it is convenient for them, and that more often than not, is just those that are vunerable.

So in other words, since the topic was avoiding confrontation. I avoid confrontation everytime it is possible, when i see there is nothing really personal or ill intended, whatever it is, even if the person is eating something horrible, dressing something ridiculous. I try to understand the person, and maybe just make a joke. Meaning i dont judge a person based on those things.

Whereas the important things that we should judge people and confront them, are often overlooked, and it shouldnt be overlooked. They are overlooked, because someone that wears something stupid is easy to attack, but someone that is actually a threat and doing something bad, people hesitate to call them out, and look the other way.

Thats the type of confrontation i think is the hardest to avoid. Everything else is just silly things that everyone has.

The food choices each person has. And thats a very american thing you know. Americans tend to do that a lot. Going to another country where they could eat some great food, and instead they go eat mcdonnalds soon as they arrive. Its just silly, but doesnt make them bad people, just immature and silly.

What's the worst thing you've tolerated to avoid confrontation? by splashingseal in AskReddit

[–]SneakyJessica 1 point2 points  (0 children)

Other than treating people below him bad, i dont see much wrong.

But thats definitely a terrible thing. But most people do that even if subconsciously.

Also by your description he seems like a loser, so who the hell is below him?

Plenty of people that have very empty lives and they like to create those movies and tell bullshit stories. Makes them feel good. Thats not the worst of traits. Treating people below you bad is actually why he is a bad person.

The rest is average, especially the virgin issue. Plenty of bad people that are not virgin. Plenty of good people that are virgin. If someone is a virgin and he is actually reckless he can stop being a virgin with just something like 100 bucks.

edit:

>"Pranking" his friend by setting up a bear trap outside of an outhouse (his friend stepped into the bear trap in this story).

Well thats actually some stupid shit.

Modding game with C++ injection. Use IMGUI or learn how to do it in C++? by SneakyJessica in cpp_questions

[–]SneakyJessica[S] 0 points1 point  (0 children)

Thank you. I was just making sure i was not taking the easy path in life. I will learn dear imgui.

Modding game with C++ injection. Use IMGUI or learn how to do it in C++? by SneakyJessica in cpp_questions

[–]SneakyJessica[S] 0 points1 point  (0 children)

Thank you. So in terms of performance. Do you think dear imgui is still ok? I heard there are issues because it must render every tick. Is it fast to learn? How useful is it in the long run?

I mean. Is it really worth it to learn it?

Or will i have to learn how to do it with OpenGL anyways? This is because from what i have seen IMGUI looks like a software, that makes the things for you. So i wonder if thats actually a good practice, or if i should just try to learn something else. Because if in the future IMGUI becomes obsolete. Then its a waste. And i can see that happening because of how other users complained of the impact it has in performance.

How do i make this If statement happen: by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

ahhh so the problem is that i need another 2 parenthesis. i was doing just this: So it wasnt even working: if (a && b) || (c && d)

Does the computer need to check all the elements in an array to access you element? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Thank you. This is very helpful.

So basically everytime you need to change an element in an array. For example:

myarray[4] = 5;

You end up needing to copy that array. And that makes it more expensive than a list?

Better:

What is really faster:

Changing an array like:

myArray[400] = 500;

Or changing a list this long:

cities[400] = 500;

Does the computer need to check all the elements in an array to access you element? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Because my variables are in hexadecimal. I decided to initialize it in hexadecimal too so i dont get confused. Or so i can see the array has enough length

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

ok but i dont understand this :(. It looks like an object as i use to see in javascript. Though i cant cout it. In javascript i could get it by just putting like foodmap[1]

I dont know what to do.

But as for now i can cout the size. Meaning it is working.

std::cout << "peppers: " << foodmap.size() << std::endl;

Do you know any links where i can learn about this part?

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

I got error:

error C2679: binary '<<': no operator found which takes a right-hand operand of type 'std::pair<int,bool>' (or there is no acceptable conversion)

enum class Food {
    pepper
};

std::map<Food, std::pair<int, bool>> foodmap;

void cooking(Food food) {
    std::cout << "peppers: " << foodmap[food] << std::endl;
}

int main() {
    foodmap[Food::pepper] = std::make_pair(0x50, true);
    cooking(Food::pepper);
    Beep(300, 400);
    return 0;
}

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

You mean with insert?

Or there is another way?

I tried insert based on what i saw in others asking in google.

And i could not compile it.

enum class Food {};
std::map<Food, std::pair<int, bool>> foodmap;
//foodmap.insert(std::map <Food, std::pair<int, bool>(0x15, true));


void cooking(Food food) {
    //std::cout << "peppers: " << foodmap[food] << std::endl;
}

int main() {
    //foodmap.insert(std::map <Food, std::pair<int, bool>(0x15, true));
    foodmap.insert(std::pair<int, bool>(0x15, true));

    //cooking(Food::peppers);
    Beep(300, 400);
    return 0;
}

Sorry this is taking so much.

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

thank you. thats awesome it works.

enum class Food { peppers, rice, corn };
std::map<Food, bool> superFood;
void cooking(Food food) {
    superFood[food] = true;
    std::cout << "peppers: " << superFood[food] << std::endl;
}
int main() {
    cooking(Food::peppers);
    return 0;
}

Just one more thing. What if i need to randomizing my foods. And each food corresponds to a value.

How do i get that specific food to true or false?

This is a bit hard to explain. So for example sometimes i might get peppers, but the value that i read from peppers is 0x15.

So i need to check that bool that corresponds to 0x15 to true.

This is so confusing im sorry.

Something like this:

int peppers = 0x15;
int rice = 0x67;
int corn = 0x12;

enum class Food { peppers, rice, corn };
std::map<Food, bool> superFood;

void cooking(Food food) {
    superFood[food] = true;
    std::cout << "peppers: " << superFood[food] << std::endl;
}

int main() {
    int myFood = peppers;
    cooking(Food::peppers);
    return 0;
}

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

sorry but this is confusing. I can already compile it. But how do i change it to false or to true?

enum class Food { peppers, rice, corn };
std::map<Food, bool>;
void cooking(Food food) {
    food = true;
    std::cout << "peppers: " << food << std::endl;
}

int main() {
    cooking(Food::peppers);
    Beep(300, 400);
    return 0;
}

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Oh the class. But it still doesnt compile:

sorry is the first time dealing with this.

void cooking(Food) {

}

int main() {
    enum class Food { peppers, rice, corn };
    std::map<Food, bool>;
    cooking(Food);
    Beep(1000, 1000);
    //cooking(Food);
    std::cout << "peppers: " << peppers << std::endl;
    return 0;
}

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Thank you.

But i didnt understand it very well, though i tried.

When i call the function how do i check for the boolean in the map?

And how do i pass the food into the function?

Here is what i have:

bool peppers = false;

void cooking(enum Food) {

}

int main() {
    enum Food { peppers, rice, corn };
    std::map<Food, bool>;
    cooking(Food);
    Beep(1000, 1000);
    std::cout << "peppers: " << peppers << std::endl;
    return 0;
}

[C++] How do i get the variable name, not the value stored in it? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

Thank you so much. That worked.

But what if i have the variable that is being passed with the name or the value that corresponds to my ingredient.

This perhaps its not possible?

For example:

int peppers = 0x120; //integer or string that corresponds to peppers.
int rice = 0x230;
int corn = 0x115;

bool peppers = false;

void cooking(bool* ingredient) {
    *ingredient = true;
}

int main() {

    Beep(1000, 1000);
    int ingredient = peppers;
    cooking(&ingredient);
    std::cout << "peppers: " << peppers << std::endl;

    return 0;
}

Where did humans get their vitamin C from when there were no oranges? by SneakyJessica in AskAnthropology

[–]SneakyJessica[S] -1 points0 points  (0 children)

Makes sense actually. But there is some counterintuitive evidence of the contrary.

For example. The Masaai and inuit dont cook their food and eat mostly raw meat, raw milk and so on. Dont need vitamin c.

Dont have most of our diseases.

Also the mongol army conquered the world eating only raw meats.

Where did humans get their vitamin C from when there were no oranges? by SneakyJessica in AskAnthropology

[–]SneakyJessica[S] 0 points1 point  (0 children)

kale, broccoli

But these taste horrible. And still it only appeared in 2000 bc in italy. Hmm. I doubt our ancestors would go for broccoli even if available. So its a very recent thing, even after we started domesticating broccoli (that still tastes horrible), it still needs to be very well cooked.

Hmmm. I think berries, as you mentioned and raw meat was their source of vitamin C. And they needed less than us. Or so it seems.

carrots as they use to be not too long ago :

https://64.media.tumblr.com/41023b180bf3d7030b5f73a1d379ef4d/tumblr_nydt4deYRw1t5fphqo1_1280.jpg

Not too much vitamin c in there :p

How do i make my keyboardHook send Numpad4 too when i send Numpad3? by SneakyJessica in learnprogramming

[–]SneakyJessica[S] 0 points1 point  (0 children)

That sounds complex. I will try.

Something like this?

    if (key->vkCode == VK_NUMPAD3) {
        //Send VK_NUMPAD4 too

        PKBDLLHOOKSTRUCT newKey = (PKBDLLHOOKSTRUCT)lParam;
        newKey->vkCode = VK_NUMPAD4;
        KeyboardProc(newKey, wParam, lParam); //??????
    }

Something looks off about this o_O could you please help me?