Anonymous
Why don't you try it? It looks like this will print the average of the 5 numbers.
Please help me, I did not understand this passage ### If the parentheses are removed, we obtain a + b + c + d + e / 5, which evaluates incorrectly as: a + b + c + d +e/5 ##
Anonymous
That's basic math, division goes before addition.
I did not understand the second section of the question
Anonymous
//m=A+B+C+D+E/5 #include <iostream> using namespace std; int main (){ int A, B, C , D , E , sum , m; cout <<"enter the A & B & C & D & E \n"; cin >>A>>B >>C>>D>>E ; sum = A + B + C + D + E ; m=sum/5; cout <<"_____________\n"; cout <<" m = "<< m;} ......, Is that True or false 😐😐
Al
Hello i was looking for some graphical library to use with C , i need to visualize data structures like double linked list , trees , or graph , have anyone a suggestion on what to use?
Jaen
You could use gtk as a graphical interface, however I don't know if It's easy for you to show trees
Al
i think i just found graphviz lib
Al
reading manual
Anonymous
• All thanks and appreciation to Mr. @ollirz for his assistance to the group members .
amit
/get
Akhil
How to start studying c++ for first time?
Roshan
How to start studying c++ for first time?
Just start and find interest
Anonymous
Hii
klimi
Hii
Hi, What is your issue?
Swapnil Kumar
Spam
Anonymous
/ban Shanuka stupid PMer
Anonymous
Hiii
Anonymous
/warn @Abraham_on PMing
Anonymous
Hi
Anonymous
Hi
This isn't a group to say ("hi") x3 , read rules
Anonymous
/get
Anonymous
https://pastebin.com/H6Xur6pw
Anonymous
I get an infinite loop, why?
Igor🇺🇦
I get an infinite loop, why?
Are you sure that your f is valid? Code looks fines except for excessive use of malloc. Do you know what values of char you're getting? Does it read the file? Did you debug the issue.
Lava
Are pictures allowed ?
Lava
I am getting different outputs for the same code on different compilers .
Anonymous
I am getting different outputs for the same code on different compilers .
1. You probably have undefined behavior 2. Use godbolt.com
Lava
Ok thank you
Engineer
Anyone know various ways to do the function factorial especially for writing C++ for hardware development?
Anonymous
You can use recursion or lots of selections to make a factorial function
...
/get cbook
Rifat
how can I provide the logic if I was asked to print the sum of that specific column which will be given by the user?
Rifat
I code a logic but it's printing the whole sum of each column
Tangent Alpha
void print_double_array(void **array, int type, int size) { /* Write your code here */ int i; if(type == 0){ for(i = 0; i < size; i++){ printf("%.2f %.2f %.2f %.2f", array[i][0], array[i][1], array[i][2], array[i][3])); } } else if(type == 1){ for(i = 0; i < size; i++){ printf("%d %d %d %d %d", array[i][0], array[i][1], array[i][2], array[i][3], array[i][4]); } } }
Tangent Alpha
warning: dereferencing ‘void *’ pointer error: invalid use of void expression
Tangent Alpha
how can I fix this?
Lava
#include <stdio.h> int main() { int i = 10, j = 20, k = 0; k = (++i) + (--i) + (j++); printf(" %d\n %d \n %d ", i, j, k); return 0; } /* What will be the output for this ? 10 21 41 Or 10 21 40
Lava
I am super confused if c does increment operations left to right or right to left .
Ludovic 'Archivist'
I am super confused if c does increment operations left to right or right to left .
Either is valid in C, your compiler can do whatever it wants on that regard
Lava
So it would depend computer to computer?
Starichok
Hello friends, i have a problem to solve, who will help me please 😌
Ludovic 'Archivist'
So it would depend computer to computer?
Anything can happen when it comes to this ordering, it is undefined behaviour
Ludovic 'Archivist'
Don't ask to ask
ברני
how can I fix this?
First do 2 for loops for 2d array..
Pavel
I am super confused if c does increment operations left to right or right to left .
It different for pre and post increment/decrement https://en.cppreference.com/w/c/language/operator_precedence But in this case it's UB (as Ludovic already mentioned), details https://stackoverflow.com/questions/949433/why-are-these-constructs-using-pre-and-post-increment-undefined-behavior
Anonymous
Hey people am new to this and I kindly would love to have a mentor❤️
Tangent Alpha
First do 2 for loops for 2d array..
No need, I know that the column size is always 4 on the first one and 5 on the second one.
Pavel
No need, I know that the column size is always 4 on the first one and 5 on the second one.
You probably need to cast and dereference your pointer e.g. instead of array[i][1] do *((double*)array[i][1]))
Pavel
To make it double
Pavel
But I'm not sure what exactly you store there
Tangent Alpha
But I'm not sure what exactly you store there
there was two types of arrays which are storing integers and floats
Tangent Alpha
void print_double_array(void array, int type, int size) { /* Write your code here */ int i; if(type == 0){ for(i = 0; i < size; i++){ float **x = (float)array; printf("%.2f %.2f %.2f %.2f", x[i][0], x[i][1], x[i][2], x[i][3])); } } else if(type == 1){ for(i = 0; i < size; i++){ int y = (int)array; printf("%d %d %d %d %d", y[i][0], y[i][1], y[i][2], y[i][3], y[i][4]); } } }
Anonymous
Hello, everyone, I have got a question. During data entry via cin, memory called a buffer holds these entries until extracted into variables. Suppose I have got a single variable and given this code bit; int num; cin >> num; while (cin) { cin >> num; } cout << num; And my entries are 1, 2, f At the end of program execution, num = 0. But my expectation is after input stream enters a fail state, num = 2. So what happened????
Ioann_
hi guyZZZ, can i post here link to my C++ optimization educational channel ?
Igor🇺🇦
hi guyZZZ, can i post here link to my C++ optimization educational channel ?
What's wrong with discussing C++ optimisations in this channel?
Ioann_
What's wrong with discussing C++ optimisations in this channel?
nothing, but in my channel u can find some cool tricks and hacks
Dima
hi guyZZZ, can i post here link to my C++ optimization educational channel ?
I am not against tho, but tg bot will remove the link lol
Igor🇺🇦
I am not against tho, but tg bot will remove the link lol
I think it removes only invites for to other groups with "join"
Dima
Well I was already subscribed lol
Dima
Ioann_
Thx!
Pavel
In my ide, default values of an uninitiated int variable is 0 so I guess that would be it. Thanks.
Here it is, two blocks that start with "If extraction fails", for prior C++11 and after https://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt
Pavel
Probably should be the case
Anonymous
Thanks
Anonymous