Anonymous
Guys can you help me complete the following function please🙏 Def XOR (a,b) # both a and b are booleans # if both are equal return true # else return false
#include<iostream> using namespace std; bool isEqual(int a, int b) { return (a==b); } int main() { Int a,b; cout << "Enter an integer: "; cin >> a; cout << "Enter another integer: "; cin >> b; if(isEqual(a,b)==true) { cout << "true" << endl; } else {cout << "false" << endl;} system(“pause”); return 0; }
Yashraj Yadav
Guys can you help me complete the following function please🙏 Def XOR (a,b) # both a and b are booleans # if both are equal return true # else return false
#include <iostream> using namespace std; bool XOR( bool a, bool b) { if ( a && b) { return true; } else { return false; } } int main() { bool a, b; cout << "Enter boolean a:"; cin >> a; cout <<"Enter boolean b:"; cin >> b; cout << XOR(a, b); system("pause"); return 0; }
NebAbdi
Thank you guys😊🙏
Deepak Chaurasia
?
Deepak Chaurasia
Ohk
Yashraj Yadav
no, not at all
he meant system("pause") functions like getch()
Yashraj Yadav
if true return true? NO.... DON'T WRITE CODE LIKE THAT
ooo wait a min, yes he said if both true then return
Yashraj Yadav
Yeah
klimi
Check now edited... 🤔
now it's even worse and it doesn't even comply with the question... if they are equal return true... which is == like i have said previously
klimi
but like... why do you write if ( a==b) return true; else return false;?
klimi
like tha'ts the up with that.... firstly, if you have return in if, you don't need to have the else branch because return is in the first one
klimi
secondly... you could just write it as return a==b;
klimi
thirdly, you don't need function to do that... it's already an operator so just use that in the code
klimi
4. you don't need and should not use system("pause")
Yashraj Yadav
Oooo F I am sorry, mind is f*ed up
klimi
5. using namespace std; is not considered a good practice
Yashraj Yadav
𝓐𝓶𝓲𝓻
Hello everyone! I am a begineer , i m want to learn c++ and earn money its . How do i begining?
Yashraj Yadav
nah my typo
I created a function cause his questions said
Yashraj Yadav
bool XOR (bool a, bool b) { return a == b ;}
klimi
yeah, i have said the whole question is wrong at start
klimi
1. it's not xor, it's equality; 2. you don't need a function for it
Yashraj Yadav
I know but he asked for it use a function 😅
𝓐𝓶𝓲𝓻
you learn the language and apply to a job
What is the best way to learn Programming??
klimi
What is the best way to learn Programming??
there is nothing specific, just as you usually learn
\Device\NUL
he meant system("pause") functions like getch()
getch() is doesn't exist in ANSI C and should removed since it's not DOS era anymore
DaviChan
What is the best way to learn Programming??
Reading and practicing. Like math you need to really practice. I think that is what people overlool sonetimes. Dont get stuck in "tutorial hell" Get a good book, only one and pick a project after reading it. Do everything to complete that peoject. Also practice what you read in the book after every chapter
DaviChan
Its fine to watch complementary vidoes, but see them as addition and dont force yourself to watch all, just what you need to understand currently 🤔
DaviChan
I think after all that you can learn things more deeply/broadly and have a good base
Egro
Amen to David
Anonymous
wtf
DaviChan
wtf
Whats up?
Unknown
I’m really struggling with doing a maze game with the solver, I have been searching a lot to find something clear and easy as only coding with no any UI
DaviChan
Anyone good with cmake? 😅 i want to have a version file and reconfige the project if the version file changes. None of what i have tried worked so far, any hints would be appreciated. Having a custom target on the version file is fine, but from there i dont know. I need to set tze project Version somehow at build time
DaviChan
Yeah, deleting the cache completely is not an option unfortuantely :/
محمد
how Insert node in last linked list and dont using any loop
محمد
?
touhou
If anyone work with maze, can you help
https://en.wikipedia.org/wiki/Pathfinding
touhou
Is this what you're trying to do?
correctmaninwrongplace
I used this book for my thesis
alessandro
does someone knows programming with avr, in c? -> in specific is there docs about sensors?
Michel
\0 ?
Michel
What are you trying to do?
Unknown
Unknown
http://www.mazesforprogrammers.com/
Thank you I’ll check it,
alessandro
anyone program with microcontroller?
alessandro
nop
alessandro
avr architecture
alessandro
https://en.wikipedia.org/wiki/AVR_microcontrollers
Anupam2.7
question is to swap alternate element. sample input: {1,2,3,4,5,6}, output={2,1,4,3,6,5} in this question how should I swap if the size of array is odd. What could be the sample output of the input array {1,2,3,4,5}???
\Device\NUL
Is it Litlle endian ? If yes, then map them into a sequence of bytes and then you'll understand why it is 5
\Device\NUL
And two's complement number
alessandro
so easy, you could just find in google
Anonymous
I need help in a proyect
Anonymous
With this cutes eyes in arduino
Anonymous
Im doing a arduino eyes with a oled screen but the code i found in YouTube isnt work well, and i want to know if someone can helpme
Mohammad
Hi... I need help with code plz
klimi
Hi... I need help with code plz
Read the rules and how to ask section
Thadeu
Hello folks Does someone used an aproach like this for arrays or knows issues on portability or any penalty? I really need to stick to C, avoid VLA's and not use a bloated lib as dependency. https://solarianprogrammer.com/2017/01/08/c99-c11-dynamic-array-mimics-cpp-vector-api-improvements/
%Nikita
anyone program with microcontroller?
I am currently learning avr c
Thadeu
This article doesn't even have NULL handling properly in case realloc() or malloc() failed
ok, but the approach to the two first two indexes? In the case I would change a bit...
alessandro
I am currently learning avr c
I learnt about basic of avr c, I mean shift register DDR, PORT, PIN but I'm looking for doc about sensor, and advanced functions.
Eshan
new to programming
alessandro
Currently I'm able light up a led...