Pavel
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 😐😐
Igor🇺🇦
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
Anonymous
Akhil
How to start studying c++ for first time?
Roshan
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
Junaid
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.
Anonymous
Lava
Are pictures allowed ?
Lava
I am getting different outputs for the same code on different compilers .
Anonymous
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
Engineer
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'
Lava
So it would depend computer to computer?
Starichok
Hello friends, i have a problem to solve, who will help me please 😌
Ludovic 'Archivist'
Don't ask to ask
Pavel
ברני
Anonymous
Hey people am new to this and I kindly would love to have a mentor❤️
Pavel
To make it double
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]);
}
}
}
btw the problem with this piece of code is the array has sent with void pointer to the function, and square brackett operator needs a concrete data type to operate in defined manner
Pavel
But I'm not sure what exactly you store there
Tangent Alpha
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]);
}
}
}
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]);
}
}
}
this works perfectly
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????
Anonymous
Ioann_
hi guyZZZ, can i post here link to my C++ optimization educational channel ?
Igor🇺🇦
Igor🇺🇦
Ioann_
Dima
Dima
Well I was already subscribed lol
Dima
Ioann_
Thx!
Pavel
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????
You probably do 3 iterations, before exiting the loop, the last one reads invalid value and operator>> still needs to put something to num (probably it puts a default value but I'm not sure, need to look at the specification).
Anonymous
Pavel
Probably should be the case
Anonymous
Thanks
Anonymous