Anonymous
the sequence point is at the ;
Anonymous
alternatively, what stops a full computation (value computation and side effects) of the left side, followed by the full computation (value computation and side effects) of the right side. (or right side first, left side second) result is 13 in this case
Anonymous
in case of a well defined expression, you will be able to figure out the answer using the sequence point rules alone. there will be no ambiguity. (unspecified behaviour does not affect the end result)
Anonymous
I'm developing a game as well
How is the game going? You want a partner on it?
Anonymous
Hello
Anonymous
I need help pls
Anonymous
Can you help me
Anonymous
I have pic and i need code in c++
shriman_deepak
#include<iostream> using namespace std; int main() { int num; cin>>num ; if (num<100) { cout<<"number is less than 100"; } else cout<<"number is greater than 100"; return 0; }
shriman_deepak
what is wrong with this code
Captain
what is wrong with this code
What's the error?
shriman_deepak
What's the error?
Not getting the result
shriman_deepak
The code is right ?
shriman_deepak
Yeah
Can i dm u ? Unable to send picture here
Anonymous
shriman_deepak
#include<iostream> using namespace std; int main() { char alphabet [1] cout<<"Enter an alphabet"; cin>>alphabet; switch ( alphabet) { case a: cout<<"Apple"<<alphabet<<endl; break; case b: cout<<"Ball"<<alphabet<<endl; break; default: cout<<"kuch nhi"<<alphabet<<endl; break; } return 0;
shriman_deepak
please check this one
shriman_deepak
Sorry where ?
shriman_deepak
tut8.cpp:6:5: error: expected initializer before 'cout' 6 | cout<<"Enter an alphabet"; | ^~~~ tut8.cpp:7:10: error: 'alphabet' was not declared in this scope 7 | cin>>alphabet; | ^~~~~~~~ tut8.cpp:11:10: error: 'a' was not declared in this scope 11 | case a: | ^ tut8.cpp:14:10: error: 'b' was not declared in this scope 14 | case b:
shriman_deepak
Bro i am getting weird error
shriman_deepak
Then what to do ?
shriman_deepak
Not working
BOSS
Not working
what error will show ??
shriman_deepak
what error will show ??
M_allocated_capicity
BOSS
wait i will send you a right code
BOSS
#include<iostream> using namespace std; int main() { char alphabet; cout<<"Enter an alphabet"; cin>>alphabet; switch (alphabet) { case 'a': cout<<"Apple"<<alphabet<<endl; break; case 'b': cout<<"Ball"<<alphabet<<endl; break; default: cout<<"kuch nhi"<<alphabet<<endl; break; } return 0; }
shriman_deepak
Why it's not working in my laptop 🙄
shriman_deepak
Sorry it's working now 😁
shriman_deepak
I forget to save 😅
BOSS
ok
Anonymous
is it a good idea to link against a system tbd file and a non system library? eg root/systemLib.tbd sysroot/systemLib.(dylib/so/dll/lib/def/a)
Anshul
https://pastebin.com/cvr4Ji7x
Anshul
this code is running fine on my ide but not on leetcode,
Anshul
anyone please look into this and help me find out where i have gone wrong
Pavel
this code is running fine on my ide but not on leetcode,
Hi, does leetcode say what it doesn't like about this code? Does it crash, or not compile, or time limit exceeded?
Anshul
But I found out the problem. Actually leetcode doesn't work when we use a static variable
Anshul
I did the same code with using a reference variable and it worked
Hanz
Because you're assigning 0 to a in the if statement instead of comparing them
Hanz
And 0 is a false value
ThanuC
In the if statement you have to put double equation also..
Hanz
Because non zero numbers is equal to true
Hanz
No problem
Eturnus
in if condition use == instead of =
Eturnus
#include<stdio.h> int main(){ int a=0,b=10; if(a==0){ printf("true"); } else{ printf("false"); } return 0; }
Yuvanth
"I need a program that the input should be taken as 200 questions and gives the ouput as 20 questions random choice Please guys"
Yuvanth
Can anyone help me
Kishan
Given a sequence of integers, I need to get the number of contiguous sequences such that (k) th element of sub-sequence is max of entire sequence: inputs: testcases n and k for each testcase and n space separated integers outpu: number of possible sub-sequences For that I wrote this code int main() { int t; cin>>t; while(t--) { long long n, k, mi=0; int max=INT_MIN, count=0; cin>>n>>k; long long arr[n]; for(long long i=0; i<n; i++) { cin>>arr[i]; if(max<arr[i]) { max=arr[i]; mi=i; } } if(mi>=k-1) { count+=n-mi; } cout<<count<<endl; } return 0; } And ran some testcases it works but when I submit this solution it gives wrong answer and I can't find out the problem so any help.......?
Kishan
Codechef 😶😶
got it solved
Captain
got it solved
No, i had same issued with many problems.
51ne
/get cppbookguide
Anshul
In case of char arrays in c++, why I can't do this to copy char arrays. a=b; Say a and b are two char arrays
Alex
Just copy links
Alex
a = *b
Alex
Or: char[] *a = *b;
Alex
Or: char[] *a = *b;
It's not correct
Alex
char *a = b;
Mr.
In C++, all code in main function will run, but have some case the compiler will run the code out of it?
Anshul
a = *b
This should not be correct. Because a is a const char pointer
Vlad
It has overloaded operator=
Mr.
Yes
Vlad
Only if you assign to a static variable
Vlad
And you've guessed it. All the code will be within a function
Vlad
Just being called before entering main
Mr.
Hmm, okey. So only in main the code will be executed, but some functions need to be declared before
Vlad
But you can only supply a header with what main would call
Vlad
It doesn't need to know about everything else