Anonymous
How do i do that bro
Just add a parameter to that function like how you have defined unitConsumed. Right now it has no parameters
f
/get cbook
Peace
how can I check whether my C++ compiler version is latest ?
Peace
what is the use of const keyword while printing an array ? https://pastebin.com/SfhLvxUQ
Anonymous
what is the use of const keyword while printing an array ? https://pastebin.com/SfhLvxUQ
It is a const reference. It means that the array won't be changed by the function (which is obvious here because you are just printing the array and this you don't have to change anything in the array) and the fact that it is a reference means the array won't be copied into the function and is thus more efficient. Since it is a const reference, you can also pass temporaries as arguments to the function. Also const references enforces an important property called immutability which becomes very important when you are dealing with multithreading.
Anonymous
would you please explain how it is more efficient ?
Because it is not copied into the function. Normally when you pass a variable by value instead of by reference, a copy of the variable is made. A std::array inside a function is allocated entirely on the stack. When you pass this variable by value to multiple functions, then multiple copies of it are made on the stack. Passing a reference saves this work.
Anonymous
how a copy of variable is made when passing by value ?
Read about "pass by value" and "pass by reference" in C++. There are many resources available for it online and they would explain it in much more detail than can be done in this group.
Abhishek
Does anybody know how to render a node network using wxWidgets? or should I go for some other crossplatform library? (C++, MinGW, CMake)
Abhishek
Like the node editor in blender or unreal engine
Mike
Hi there! Could someone explain the expression inside the if statement for me? If you can rewrite this to Python, I'd really appreciate :) constexpr auto kWideIdsTag = ~uint64(0); auto legacyUserId = Serialize::read<qint32>(stream); auto legacyMainDcId = Serialize::read<qint32>(stream); if (((uint64(legacyUserId) << 32) | uint64(legacyMainDcId)) == kWideIdsTag) {
Manu
How to find second largest number among three ?
Luca
Hello guys, I'm not so skilled with makefile and also with english, I'm trying to explain you my problem. I've two directories with several .cpp files and one make file for each directory. I would like to drop file1.cpp of project B on project A, obviously I've to change makefile of project A correctly but I didn't find any solution to marge those 2 makefiles. My idea is: Can I compile file1.cpp with makefile of project B and than drop the file1.o to project A and directly linking it the object file?
Talula
How to find second largest number among three ?
#include <stdio.h> int main() { int a[3] = {41,55,12}; int max = -1000; int min = 1000; int maxi = 0; int mini = 0; for (int i = 0; i<=2; i++) { if (a[i] > max) { max = a[i]; maxi = i; } if (a[i] < min) { min = a[i]; mini = i; } } for (int i = 0; i<2; i++) { if (i != maxi && i != mini) printf("second:%d\r\n",a[i]); } }
Kartik
What is INT_MAX and INT_MIN
Anonymous
What is INT_MAX and INT_MIN
Max and Min values of int
Anonymous
I guess signed
Kartik
Instead of -1000 and 1000
Fahad
Hello good people
Sam
Guys how to print days of a week using circular queue I got that topic I searched for the program online but didn't get any
Sam
Circular queue using linked list
klimi
Use English please
Pritam
Circular queue using linked list
Is it specified in que?
Na
Hey I have to make a setup where the led turns on with a push button I need to use gpio pins of raspberry pi for that and bcm2835 library with c++ I don’t know really where to begin can I get some help with it if possible
Himanshu
I want to setup OpenCV in a windows machine. There is a blog which has steps with VS Code. We can also use Visual Studio to set it up. What would be better here?
Himanshu
that's great. VS Code would also need less space compared to Visual Studio
Suka
Problem is this is wiringpi I need to use bcm2835
perhaps check linux kernel? does it support bcm2835? and change wiringPi source to use bcm2835 module?
Na
We use like a raspberry pi and use it on cmd so we don’t use it on like Linux itself but just windows cmd
Na
I tried looking for tutorials online or maybe codes online that could explain it but the ones I found just go straight to the code without explaining it and use mostly python instead of c++
Na
So I just got stuck on what to do after that
Suka
We use like a raspberry pi and use it on cmd so we don’t use it on like Linux itself but just windows cmd
do you means rpi running linux and you access it via serial terminal or ssh? if this true then you can use lsmod to see what kernel module already loaded. n ig this is not related to cpp. try find rpi group perhaps they can assists you better? cmiiw
Na
do you means rpi running linux and you access it via serial terminal or ssh? if this true then you can use lsmod to see what kernel module already loaded. n ig this is not related to cpp. try find rpi group perhaps they can assists you better? cmiiw
I don’t really understand what you mean here completely but what I meant is that the pi is running as a driver instead as a “pc” so its like a second driver in windows and I access it on cmd and I actually do use cpp files when I run files on cmd
Tyrone
C++ program to capture names of people, store them in an array structure and manipulate the array structure using: 1.Stack structure 2.Queue structure Google but couldn't find any help
Na
hmm sorry i don't know your setup. just wait other user goodluck
Understood by setup you mean the breadboard setup?
Suka
Understood by setup you mean the breadboard setup?
i mean how you using rpi what os did you use linux, win10 iot, plan9, custom firmware aka bare metal etc.
Anonymous
would a command list be easier to optimize in chunks?
Anonymous
however this would also increase memory usage as we already have a max of x2 memory usage if no optimizations can be made
Suka
I am using windows 10 rpi zero
https://raspberrypi.stackexchange.com/questions/39715/can-you-put-windows-10-iot-core-on-raspberry-pi-zero#39735
Suka
? But it does work though like I have run files on it
you better ask your teacher what os in it? sorry i can't help you.
Suka
ooo ic hehe. ig it depends on you now hehe. if you have time try this command in you rpi cmd terminal uname -a (enter) and what output from it.
Na
Owh
Na
Linux mypi 5.10.17+ armv61 GNU/Linux
Suka
Linux mypi 5.10.17+ armv61 GNU/Linux
now lsmod | grep 2835. if you find it. find and change wiring pi source code from 2708 to 2835 compile and run it i never try this before so proceed with caution or just wait for other goodluck.
Na
Maybe I didn’t explain it good what I want is how can I code with bcm 2835 in c++ to turn led on with button
Anonymous
/get cbook
Anonymous
/get ide
NagaRaju
Hi guys I’m trying to give a returned value to another function to perform a task but its not working I’ve googled for a long time and i still can’t find a solution So if anybody can help me out🥲
MODIFIED VERSION : #include <iostream> using namespace std; string CustomerDetails(string name){ // this function is not mandatary you can just print from main cout<<"\n***** Welcome "<<name<<" *"<<endl; cout<<endl; return name; } int unitConsumed(double previous,double current){ double unit; unit = current - previous; return unit; } string customerType(double p, double c){ // taking parameters bcoz you can't say meter reading directly string domestic = "Domestic", industrial = "Industrial", commercial = "Commercial"; if (unitConsumed(p,c) < 100) return domestic; else if (unitConsumed(p,c) > 100 && unitConsumed(p,c) <= 200) return industrial; else // place 'else' instead of 'else if' then complier won't warn you return commercial; } int main() { string name; cout <<"Please Enter Your Name: "; getline(cin,name); // CustomerDetails(name); double currentMeter, PreviousMeter; cout <<"\n\nEnter Previous Meter Reading (kwh): "; cin>>PreviousMeter; cout<<"\nEnter Current Meter (kwh): "; cin>>currentMeter; unitConsumed(PreviousMeter, currentMeter); cout<<endl; cout<<unitConsumed(PreviousMeter, currentMeter); cout<<endl; cout <<customerType(PreviousMeter, currentMeter); return 0; }
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Anonymous
What is stack smashing detected??
Anonymous
I need to ask one query here. But i cannot send the images here. Can i dm someone in this group?
olli
I need to ask one query here. But i cannot send the images here. Can i dm someone in this group?
sending images is disabled for a reason. Why would you need to send one?
olli
What is stack smashing detected??
usually buffer overflow errors https://stackoverflow.com/questions/1345670/stack-smashing-detected
Anonymous
sending images is disabled for a reason. Why would you need to send one?
I've to ask something related to Visual studio. Can i dm you?
olli
what's the problem? what have you done so far? Where's your code?
Google
Hii.....i am just a beginner.....can nyone suggest best websites or books or any other resources for beginners 🥺🥺🥺
NagaRaju
Thanks a lot My problem was i didn’t think taking parameters for customerType was Mandatory
You can also merge both functions (customerType & unitsConsumed ) in one to get rid of confusion
Anonymous
#pinned
Prabhat
programiz
Prabhat
programiz
Website
Anonymous
https://gist.github.com/mgood7123/bed1a3f95be78829db534c38620df519 ok now that i have the appropriate info to determine if a region should be removed or kept, how would i go about removing any regions that are the same size or smaller than the upper most region with respect to if a region is transparent or opaque ?
Anonymous
Heyyy I want to learn C++ from the Basic to the Professional level. Can Anyone help me out here?