Anonymous
MB? What?
Lack of internet
Anonymous
So ur answer is coming 20
Anonymous
K= (i+j-1) and value of x accrdg to which condition true within loop
I use Arch
I don't have enough MBs
You can try to read some text web course
Anonymous
I don't have enough MBs
Hey can u invest only 300 to 500mb per day watch only 1hr per day. Video per day you will learn c++ very well
Anonymous
K= (i+j-1) and value of x accrdg to which condition true within loop
when I am doing the output tracing I can't explain how 20 came. I calculate but the calculation result is different can you please explain me the code?
Anonymous
What problem do you wanna to resolve?
//*How 14 and 20 came on the output can anyone explain?* #include <stdio.h> main() { int i, j, k, x = 0; for (i = 0; i < 5; ++i) { for (j = 0; j < i; ++j) { k = (i + j - 1); if (k % 2 == 0) x += k; else if (k % 3 == 0) x += k - 2; printf("%d\n", x); } } printf("\nx = %d", x); } /*output: 0 0 2 4 5 9 10 14 14 20 x = 20Press any key to continue . . */
Anonymous
//*How 14 and 20 came on the output can anyone explain?* #include <stdio.h> main() { int i, j, k, x = 0; for (i = 0; i < 5; ++i) { for (j = 0; j < i; ++j) { k = (i + j - 1); if (k % 2 == 0) x += k; else if (k % 3 == 0) x += k - 2; printf("%d\n", x); } } printf("\nx = %d", x); } /*output: 0 0 2 4 5 9 10 14 14 20 x = 20Press any key to continue . . */
//*How 14 and 20 came on the output can anyone explain?* #include <stdio.h> main() { int i, j, k, x = 0; for (i = 0; i < 5; ++i) { for (j = 0; j < i; ++j) { k = (i + j - 1); if (k % 2 == 0) { printf(" when i=%d j=%d k%2=0\n", i, j); x += k; } else if (k % 3 == 0) { printf(" when i=%d j=%d k%3=0\n", i, j); x += k - 2; } printf("%d\n", x); } } printf("\nx = %d", x); } /*output: 0 0 2 4 5 9 10 14 14 20 x = 20Press any key to continue . . */ Maybe a couple of simple logs are enough for tracing what happened there.
S__R
#include <stdio.h> int main() { int i, j, k, x = 0; for (i = 0; i < 5; ++i) { for (j = 0; j < i; ++j) { k = (i + j - 1); printf("i = %d and j = %d",i,j); if (k % 2 == 0) x += k; else if (k % 3 == 0) x += k - 2; printf(" ans = %d\n", x); } } printf("\nx = %d", x); }
Anonymous
Try this
same thing?!
Anonymous
Sorry, It's hard to produce the correct code indent when I type in my phone, but what the code you post does?
Anonymous
oh i got the difference but the thing is i need to do output tracing I mean need to explain the code its my ans of the output tracing qus which is given to me.
Anonymous
\ Can you please explain how 14 came twice on the output. I am confused about it. Since, when i=4, j=1, K=4, x=10+4=14 ( Totally clear ) But, when i=4, j=2, k=5, x= ? both of the condition is false here so what will be the output here? and how?
Anonymous
\ Can you please explain how 14 came twice on the output. I am confused about it. Since, when i=4, j=1, K=4, x=10+4=14 ( Totally clear ) But, when i=4, j=2, k=5, x= ? both of the condition is false here so what will be the output here? and how?
an if condition without curly braces implicitly means its body just consists of one statement, and therefore in your code, the statement print("℅d\n", x); will always be called....
Anonymous
https://stackoverflow.com/questions/14901919/when-can-i-omit-curly-braces-in-c/47531901
Anonymous
You don't want another 14 and 20?
I solved the problem. Thanks you all for giving me you precious time.Really appreciate. ❤️
Anonymous
Thank you
Erice
hello
Erice
not a bot ✋... wanna start programming... but don’t know where to start... i’m a music producer... i use a lot vcv rack that’s why i want to make some modules... vcv rack modules are writte in c++
Erice
but i’m completly new with this stuff
Anonymous
Erice
a long journey
Anonymous
If you believe it you can do it bro.. take your time
Erice
:)
J
but i’m completly new with this stuff
I would recommend watching Cherno's videos on youtube for a solid start.
Anonymous
:)
Start learning from now there are various sources available on google to start
S__R
/report
Anonymous
/report
coal
!report
Roxifλsz 🇱🇹
/ban BAD NEWS
Lograj
How to setup graphic.h in visual studio
J
How to setup graphic.h in visual studio
graphics.h files are for traditional boreland compilers which had bgi graphics. So, it won't work with Visual studio unless you use a modified version of it like https://github.com/GabrielPTD/WinBGIM---Visual-Studio
Hsn
U r missing brackets after first loop?
https://onlinegdb.com/0553BUmbv you can always print more info to see whats going on ..
Achraf
how can I create a procedure that delete a student including his informations from a table? for example I have a table which contains 3 students 1) student 1 2) student 2 3) student 3 I ask the user to enter the number of the student that he wants to remove from the table he enters 2 what should I write as a code to remove student 2 are there any specific functions or methods? thank you
Anonymous
class Student { ... }; std::map <int, Student> students; students.erase(2);
Anonymous
Is there a strong person here C plus language 🙄
Anonymous
what?
Anonymous
what?
I just started with a language C++
Anonymous
I just started with a language C++
so you should learn it by using some books
Captain
I just started with a language C++
Just google, or search on yt
Captain
How to use VS or VS code
Null
Yeah, Google is your best friend
Captain
Which ?
/get cbook
Anonymous
I can fix your error
Anonymous
ok dm me
xxxxxxxx
Good evening
Anonymous
good Evening
DEV 7
Design 0, 1 and 2 level DFD for Traffic Light System.
数学の恋人
Does anyone know what exactly is this? std::iterator_traits<decltype(someVar)>::difference_type Interested in difference_type, if I'm not wrong is this same as, std::experimental::ranges::difference_type ?
Anonymous
That itself is a type, i want to know what it is
Those types satisfy the same requirement of template <typename T> difference_type which is either the type T::difference_type is well defined or the expression`[](const T& a, const T&b){ a - b; } is well formed. So If `template <typename T> different_type` 's template argument T is same then they are same.
Anonymous
See also 1. https://en.cppreference.com/w/cpp/iterator/incrementable_traits 2. https://en.cppreference.com/w/cpp/experimental/ranges/iterator/difference_type
Karam
Good evening guys
Karam
int A[2][3]; //filling the array ... int x = &A[1]; The same code gives error in Dev-c++ but runs on code::blocks and gives the address of the first element of the second row. The code has 2 logical errors which are : 1) storing address inside of an integer 2) storing address of an array(not just int) in a single int variable I need to know why that happened and which one is right and which one is wrong
Ash
/rules
Ash
/rules
Future
Rules, rules, rules, Isnt there a Java code to Break them?
Karam
You can only change address on pointer
But how did it work on code::blocks I though it will convert it to pointer automatically then store it but it didn't X was still 4 bytes ( in my pc pointers are 8bytes) And the address stored in x was right at then end
\Device\NUL
You do it by yourself
\Device\NUL
Size of pointer and its type is different
\Device\NUL
Even though your compiler is giving warning, it's bad
Karam
I know it is bad (my professor's example) but do you know how did it work on code::blocks , i mean an integer can just store 4 bytes but it stored 8
\Device\NUL
Btw, how did you know int pointer can hold 8 byte data while int can't ? int pointer is pointing so it's not related to its size. Pointer is used to keep address, not keep value
\Device\NUL
int data type on 64 bit arch is 32 bit. You will have integer overflow if you give it value more than it can holds.
Smita
How to write any program how to start