Anonymous
guys please recommend a good laptop for coding from under 150 dollars
Shahrukh
Problem statement Given a sentence S consisting of words and tokens separated by a single space you need to figure out whether the given tokens form a strictly non-decreasing sequence or not. Return true or false. Marks: 10 Negative Marks : 0 Fill your code here DH 2 SHOO Example1 Input I woke up at 6 AM and went for walk at 7 15 AM and then gave my exam at 16 30 PM Output True Explanation 6 <7<15 16 < 30. Example2 Input I have 5 red balls and 5 blue balls Output False
Shahrukh
Anyone
Eng.Iman
Hey everyone I hope you're doing great I need examples and excise to write codes in c++. Could u plz help me with that
Eng.Iman
P. S I am a civil engineering and start my double major this semester in programming and systems analysis We start c ++ and our profess told me that you think un civil engineering instead of programming I ll send you simple examples
Anonymous
hello guys who can translate js into c language ? pls help me
Anonymous
Step 1: learn C
😂😂😂
Anonymous
Step 1: learn C
do you know js?
Ludovic 'Archivist'
Yes
Anonymous
Yes
help me pls
Anonymous
Yes
can u?
Ludovic 'Archivist'
Make a diagram of whatever your code is doing (inputs, outputs, corner cases), throw the js away and translate that diagram to C
Anonymous
Make a diagram of whatever your code is doing (inputs, outputs, corner cases), throw the js away and translate that diagram to C
function my_spaceship(string){ let x = 0; let y = 0; let side = 'up'; let list_side = ['up', 'right', 'down', 'left'] for(i in string) { el = string[i] if(el == "R"){ index = list_side.indexOf(side) + 1 if(index < list_side.length && index > -1) { side = list_side[index]; }else { index = 0; side = list_side[index] } }else if (el == "L"){ index = list_side.indexOf(side) - 1 if(index < list_side.length && index > -1){ side = list_side[index] }else { index = 3 side = list_side[index] } } else if(el == "A"){ if(side == "up") y-- else if (side == "down") y++ else if (side == "left") x-- else if(side = "right") x++ } } return "{x: "+x+", y: " +y+ ", direction: '"+side+"'}" }
Anonymous
Rip the semicolons, you are missing
it was written in js semicolon is not important
Ludovic 'Archivist'
Anonymous
It helps readability
of course will u help?
Ludovic 'Archivist'
No? Do your own work
Ludovic 'Archivist'
Take the task at hand as a data transform and list what goes in, what goes out and rewrite from that and not the JS
Anonymous
That looks like JavaScript.
of course need to translate into c
Talula
of course need to translate into c
In C it is better not to work with strings, but making it into C++, it'll be lot similar.
Talula
hmm can u translate into c?
Can but lots of work and results will not be exactly the same... it'll be better to rewrite it if I know what input/output is required.
Ludovic 'Archivist'
the best for everyone
what is the mistake in this code // Segregate 0's and 1's In An Array using Swapping Method // in the same Attay #include<stdio.h> int main() { #define n 10; int n; int a[n] // in the last of the Array int left=0 , right=n-1 ; // or 9 printf("Enter the element"); for(int i=0; i<n,i++) scanf("%d \n",&n); while (left<right) // we have to swap in down { while(a[left]==0) // as long as its right from the left side left++; while(a[left]==1) // from the right side { right-- ; if(left<right) // to cheak if left still less than right { a[left]=0; // we are swapping them a[right]=1; left++; right--; } } } for (int i=0 ; i<n ; i++) printf("to print whole the numbers %d ",a[i]); }
ARYA
Why can't I pass an array with variables like (arr [m] [n]) that I created in another function to another function? For example : Void displayarr(arr[m][n])// i have error just here! ... ... ... ... Void makingarr() Int arr[m][n] ... ... ... displayarr(arr)
shriman_deepak
Variable scope
shriman_deepak
C - Scope Rules https://www.tutorialspoint.com/cprogramming/c_scope_rules.htm
Sandhit
There something called Local variable or global variable
yeah . we'll have to use the global variables
ARYA
There something called Local variable or global variable
I did it but i have problme yet Error said : array bound is not an integer constant before ']' token.
Amir
Write a program in C++ that asks the user to type an integer (n>3) then draws: An isosceles triangle formed of stars (*) and more (+) than n lines using the "While" loop, and without using matrices.
Amir
Help
André
What exactly do you need help with?
Amir
A program for a triangle of stars and inside it +
André
But what are you having issues with? Compiler error? No output? Runtime error?
André
If you want us to do your homework I'm afraid that's against the rules
Amir
I have a problem inserting the + sign inside the star triangle
André
If I'm understanding the task properly you don't need any '+' in the triangle only '*'
André
But it should just be a matter of appending it to a string
Amir
You did not understand me
Amir
I couldn't send a picture
I use Arch
You meant * *+* *+++* * * * * (Imagine these stars are together) ?
Josué
what line of code would you use to verify the age between the range of 18 to 25
Josué
if (18>25){
\Device\NUL
\Device\NUL
Re-read your code
Josué
im cofused
\Device\NUL
im cofused
That if statement will not doing anything as 18 > 25 is always false
Josué
im learning c
Josué
if((edad>=18)&&(edad<=25))
Nyasente
hi...anyone who can tutor me abt c/c++ from hello world ??? please dm asap
the best for everyone
can anyone tells me what is the problem in this code // Segregate 0's and 1's In An Array using Swapping Method // in the same Attay #include<stdio.h> int main() { #define n 10 int n; int a[n] // in the last of the Array int left=0 , right=n-1 ; // or 9 printf("Enter the element"); for(int i=0; i<n,i++) scanf("%d \n",&n); while (left<right) // we have to swap in down { while(a[left]==0) // as long as its right from the left side left++; while(a[left]==1) // from the right side { right-- ; if(left<right) // to cheak if left still less than right { a[left]=0; // we are swapping them a[right]=1; left++; right--; } } } for (int i=0 ; i<n ; i++) printf("to print whole the numbers %d ",a[i]); }
Cptn
Thank you
DEV 7
anyone knows how to make uml , use case and er diagram of a software project
Laopigo
How to handle invalid long options with getopt?
.
https://godbolt.org/z/P9c8eq55j
.
Hey,what's wrong here?who can help me :)
Bing
Hi there, can anybody help me with this error?
Bing
want to use an array of pointer to functions, but got error message: unsigned char bit_decode1_1pulse_pattern(unsigned char TValue); unsigned char bit_decode2_phase_rc5(unsigned char TValue); const unsigned char (*bit_decoder[2])(unsigned char) = { bit_decode2_phase_rc5, bit_decode1_1pulse_pattern};
Bing
The error message: 37: const unsigned char (*bit_decoder[2])(unsigned char) = { bit_decode2_phase_rc5, bit_decode1_1pulse_pattern}; illegal function qualifier(s) ^
Bing
Illegal function qualifier(s), but I couldn't figure out what's wrong
.
https://godbolt.org/z/P9c8eq55j
I get the answer: use public std::enable_shared_from_this<A> to solve it
Levi
scanf("%[^\n]%*c", s); please tell me what exactly is this;
Anonymous
scanf("%[^\n]%*c", s); please tell me what exactly is this;
Scanf can read only signs until the next space comes.With this function you can read a string with spaces and with *c the newline will be deleted
Matija
/get cbook