klimi
no void function() { // code }
you and your C# style, shush
Dima
no
jaebie
I thought you asked me what I already know, sorry my bad
jaebie
what I don't know is how to calculate distance between two points
jaebie
btw, thank for the effort Dima and Klimi
jaebie
thanks*
Dima
sqrt((x2 - x1)^2 + (y2 - y1)^2)
what if one wanted to get distance between to geo points
Aquatica
what if one wanted to get distance between to geo points
Uh, I guess like 3D points? You just add a z parameter to the formula
Dima
no
Aquatica
Idk I’ve never done this
Dima
longitude and latitude
Aquatica
I searched for it on stackoverflow though, it’s pretty easy https://stackoverflow.com/questions/365826/calculate-distance-between-2-gps-coordinates
Aquatica
But I don’t think that was his question
Anonymous
Hello
klimi
what if one wanted to get distance between to geo points
https://keisan.casio.com/exec/system/1224587128
klimi
Hello
nohello.net
klimi
no
ok
Aquatica
lol
jaebie
thank you very much, guys
jaebie
Can someone help me solve the problem here cuz
jaebie
#include<iostream> using namespace std; class Two_num { public: int x,y; int sum =0; void Num(int x1,int y1) { sum = x1+y1; } }; int main() { Two_num two_num; two_num.Num(8,31); std::cout <<"The sum of the two numbers is:" << two_num.Num() << ::endl; return 0; }
jaebie
i just need to add numbers
Anonymous
#include<iostream> using namespace std; class Two_num { public: int x,y; int sum =0; void Num(int x1,int y1) { sum = x1+y1; } }; int main() { Two_num two_num; two_num.Num(8,31); std::cout <<"The sum of the two numbers is:" << two_num.Num() << ::endl; return 0; }
#include<iostream> class Two_num { private: uint64_t x1, y1, sum = 0; public: Two_num(uint64_t x, uint64_t y) { this->x1 = x; this->y1 = y; sum = x1 + y1; } auto Sum()->void { std::cout<<"The sum of the two numbers is: "<<sum<<std::endl; } }; auto main()->int { uint64_t x1, y1; std::cout<<"Enter two num: "; std::cin>>x1>>y1; Two_num *sum = new Two_num(x1, y1); sum->Sum(); }
Carlo
i have a question
Carlo
i have a function that returns a float
Carlo
is it possible to do
Carlo
char output[]=function();
Carlo
and i can't return anything from that function
Carlo
what do you want to do exactly?
dht2.readTemperature() = char rt[];
Carlo
i can't use printf to format the output
Carlo
i need a string that contains dht2.readTemperature()
Dumb
readTemperature gives a float or a char array?
Dumb
an ez way could be casting the float to int and then change it in a string or just some weird stuff with printf that I don t remember as well
Dumb
how do i redirect the output of the function to a variable?
a function gives a value in output could you save it in a var too and then operating on it?
Dumb
ah so it's a procedure i thought it was a function
Dumb
if it's void you could use referencing parameters to change one or more value/vars
Carlo
readTemperature returns a float value,but i don't know how to store that value
Dumb
if it returns a value you could save it as below f.e.: float temp = dht2.readTemperature() //do some stuff on temp//
Carlo
thanks
Carlo
i don't know why but when i tried it didn't work
Dumb
maybe misspelling or a bad format it happens
Ravindu Ishara
I want to make a programming IDE for myself. How do I get started ? Any one can help me..? To ESP 32 programming...
jaebie
Can someone help me determine the problem in my code
jaebie
#include<iostream> using namespace std; void Two_num(int j, int b) { int switch = j; j = b; b = switch; }; int main() { int num1,num2; std::cout<<"Please enter the first number: "; std::cin>>num1; std::cout<<"Please enter the second number "; std::cin>>num2; Two_num(num1,num2); return 0; }
jaebie
I need to swap the two numbers in different variables
Anonymous
David Vandevoorde - C++ Templates: The Complete Guide Anyone has a pdf of this book please?
dearfl
I need to swap the two numbers in different variables
short ans: use std::swap long ans: change function signature to void Two_num(int &j, int &b);
\Device\NUL
still not working : |
Have recompile ?
blueyi
is there a group for llvm compiler?
\Device\NUL
is there a group for llvm compiler?
What's your prob actually ?
blueyi
What's your prob actually ?
I want to learn compiler develop
Anonymous
#include<iostream> using namespace std; void Two_num(int *j, int *b) { int switch = *j; *j = *b; *b = switch; }; int main() { int num1,num2; std::cout<<"Please enter the first number: "; std::cin>>num1; std::cout<<"Please enter the second number "; std::cin>>num2; Two_num(&num1,&num2); std::cout<<num1<<num2; return 0; }
Anonymous
#include<iostream> using namespace std; void Two_num(int j, int b) { int switch = j; j = b; b = switch; }; int main() { int num1,num2; std::cout<<"Please enter the first number: "; std::cin>>num1; std::cout<<"Please enter the second number "; std::cin>>num2; Two_num(num1,num2); return 0; }
#include<iostream> typedef struct Change{uint64_t x{0}, y{0};}; auto Swap = [](auto& x, auto& y)->int { uint64_t temp{0}; temp = x; x = y; y = temp; std::cout<<"After swap: x="<<x<<" y="<<y<<std::endl; }; auto main()->int { Change c; std::cout<<"Enter two num: "; std::cin>>c.x>>c.y; std::cout<<"Before swap: x="<<c.x<<" y="<<c.y<<std::endl; Swap(c.x, c.y); }
Divyanshi
I am not able to do pattern questions Is there any trick to figure out the logic easily!?
Anmol
How can I learn and get hands on experience in Object Oriented Programming as soon as possible ? Please help....!
Anonymous
How can I learn and get hands on experience in Object Oriented Programming as soon as possible ? Please help....!
tried and experimented a lot with object orientation features and met a lot of those errors
Robert
Does anyone know of a c++ book for beginners?
jaebie
Богдан
Should I name it in to swap?
switch is a c++ keyword, name it anything except a keyword name
jaebie
I see, that's probably why its not working
Богдан
I see, that's probably why its not working
do you get verbose compilation error messages in your IDE?