Void
What are you expecting?
If I enter 14, the result should be 35, but the result is 32
Void
What are you expecting?
It looks like the values are substituted into the second if else()
Ольга
Aleksandr
Sure
do i need to randomly iterate through or there is a function ready?
Aquatica
do i need to randomly iterate through or there is a function ready?
You need to generate a number between 0, and the length of the list - 1. Then use the generated number as the index for the element
Aleksandr
You need to generate a number between 0, and the length of the list - 1. Then use the generated number as the index for the element
Ok, i have lst[random_index], but how i get tuple from that lst, i'm tried for (auto cur :: lst[random_index])
Aleksandr
Why do you need a tuple
list{(x,y), (x1, y2) (xn, yn)}, it's for coords
Aleksandr
Why do you need a tuple
Also used simple index = rand() % lst.size(), maybe it's simple if i use random_lst_index+1 for y coord, not using tuple at all, but lst would look like bunch of values
Aleksandr
is it way to do get<0>(random_index_of_lst), get<1>(random_index_of_lst)?
Ольга
Is there any syntax difference when using the pair structure in C++?
pavel
Is there any syntax difference when using the pair structure in C++?
Difference with what? Pair is just template structure with first and second fields
Ольга
Difference with what? Pair is just template structure with first and second fields
That is, it does not matter what the structure itself is called, if it contains the first and second fields, is it a structure-pair ?
Ольга
Difference with what? Pair is just template structure with first and second fields
That is, it does not matter what the structure itself is called, if it contains the first and second fields, is it a structure-pair ?
pavel
Pair<T1,T2>
pavel
T1 first, T2 second
Ольга
T1 first, T2 second
Sorry to bother you again, in this code this structure can be called a pair structure or not? https://onlinegdb.com/iwIfItEAD
Ольга
Pair<T1,T2>
Or Is it necessary?
pavel
Or Is it necessary?
Yes, it necessary
pavel
Btw, better use godbolt
pavel
pair is just template type in standard template library. In modern c++ you can use tuple instead
pavel
And questions about can we call structure pair or not important in context of template programming related with type checking known as "concepts". Not in your case
Anonymous
Why there is a mysql.h no such a file or folder ? I am on debian.
Anonymous
can somebody help me in assembly language
Anonymous
i am looking for some beginners topics
Pavel
https://onlinegdb.com/mgJA54dI_A
your functions check_number and check don't return anything except EXIT_SUCCESS, is that intended?
Pavel
I found on the Internet that this will help solve the problem (and there is no warning), but now the code does not work as it should
This code uses comma operator, comma operator does not what you expect, don't use it return p3->first,p3->second; make Union return person_str instead of a single int
Pavel
or actually you don't need to return anything from union, you can just keep it void instead
mito
can somebody help me in assembly language
Which assembly language? MIPS ? x86 ? x64 ?
mito
There are a lot of architectures.
mito
mp8051
Intel 8051 ?
Anonymous
mito
yes
There are a lot of articles on the internet that gives basic introduction to these. Such as this one..
Anonymous
There are a lot of articles on the internet that gives basic introduction to these. Such as this one..
yes but i want to have a strong grip in basics.if u have any kind of notes then share me personak
ʙʀʜᴏᴏᴍ ⑇
is there any built in function to find a root of the number... I don't want a sqrt() or cbrt() ... I want when the number root of another number for example y√x , so y is an unknown number and sorry about my English😁
Ольга
your functions check_number and check don't return anything except EXIT_SUCCESS, is that intended?
I simply need it to determine more first or second, if it is first, then it is not good and it returns EXIT_SUCCESS (if I am not mistaken, it is = 0) and already in the main function, I ask to replace this value with the correct one (that is why I decided to implement it this way ) But I have already fixed it now (it seems to work normally) and now when first>second it returns 1 and if not then 0; I hope it's better
Pavel
You mean to print it in Union?
No, your Union returns int, but you don't use the returned value anywhere because you passing the struct through the pointer argument. So you can change it to return void instead.
mito
is there any built in function to find a root of the number... I don't want a sqrt() or cbrt() ... I want when the number root of another number for example y√x , so y is an unknown number and sorry about my English😁
https://en.cppreference.com/w/cpp/numeric/math/pow When you do y√x it is the same as x^1/y. Since square root, cube root are just Any number power 1/2 for square root, 1/3 for cube root.(you can check if you want) Use std::pow(datatype base, datatype exponent). Make sure base is not negative.
Faramarz
Binary number of 202 is 11001010; is it overflow? because 202 is positive but the first digit of its Binary number is 1.
SHEIKH HAFIJUL ALI
Binary number of 202 is 11001010; is it overflow? because 202 is positive but the first digit of its Binary number is 1.
Signed binary numbers do not work like this. You either have 32 bit signed number or a 64 bit. If the first bit is "flagged" as sign then it carries a special meaning (positive or negative)
Vidyan
Hey guys...Can someone help me with a small Project?
Vidyan
😌
PI cadaeibfe
#include <iostream> using namespace std; int main() { int a; int b; cout<<"enter a "; cin>>a; cout<<"enter b " cin>>b; if(a=b) { cout<<a<<"is equal to "<<b; } else { cout<<a<<"is not equal to "<<b; } return 0; } Whats is not right?
DaviChan
if (a=b) should be a==b.
DaviChan
Also don't get in the habbit of using entire namespaces globally, please ✌
DaviChan
Also there is a ; missibg after "enter b"
Beloved
I am having a problem on how to code a binary tree using character strings.... Can you anyone give me a heads up
DaviChan
Whats your problem with it?
DaviChan
Okay, im on phone rn, so the text wraps oddly. Will take a look when on my machine later
Mohamed
how do do make cut Paper on after print in c# ?
DaviChan
but yet again. please only use "using" on what you need. Not globally on an entire namespace... I know its preference, but it really bugs me
DaviChan
im talking about the main function. Especially this part: " struct node* root = newnode(a); root->left = newnode(c); root->left->right= newnode(d); root->right = newnode(b); root->right->left = newnode(e)"
DaviChan
it looks like a, b, c, d and e are not defined there.
DaviChan
they are not global variables and also not defined in local scope
DaviChan
this looks like a homework problem to me. The point of this is that you think about that yourself. I don't mean to be rude, you can ask specific questions here all the time, but not even trying misses the point of the exercise and won't get you anywhere. Also I know you can do it!
Beloved
they are not global variables and also not defined in local scope
Yaa so how I think I am failing to define them.... Let me go on the YouTube to see if I cn find something about the declaration
DaviChan
Yaa so how I think I am failing to define them.... Let me go on the YouTube to see if I cn find something about the declaration
by simply writing this at the beginning of main() for example: auto a{'a'}; auto b{'b'}; auto c{'c'}; auto d{'d'}; auto e{'e'};
DaviChan
I think what you failed to understand is that a variables name has nothing to do with its content from a compilers point of view. You could as well call a variable banans and neither type nor it's value could be inferred from just the name itself. We often indicate content and type as programmers, for example by hungarian notation, but that is nothing the compiler would automatically pick up on or anything.
Chika
Projects for beginners in c++?
Anonymous
@Beloveddee Read the rules on how to post your code.
/
why an uint8_t is always 8 bit if it is only a typedef of a char
/
and if you use char the length may change
Anonymous
char is 1 byte in x86/GCC/Linux
Anonymous
But this may change with different compilers (idk if it is explicitly specified in ISO C standard that sizeof char == 1)
/
But this may change with different compilers (idk if it is explicitly specified in ISO C standard that sizeof char == 1)
but they told me to use uint8_t instead of char because char may change between different computers
Anonymous
Yes that's true
Anonymous
Because we have different headers for each arch specifying the correct typedef /* ... */ uint8_t;