pro player
string Solution::solve(string A) { int i=A.length()-1; int j=-1; int k; string B=""; int count=0; if(A.length()==0) return 0; while(i>=0) { while(A[i]!=' ' || A[i]!=-1) { count++; i--; } i++; k=i; for(;k<count+k;k++) { B[++j]=A[k]; } i=i-2; } return B; }
Felix
Can someone reccomend me a data structure pdf?
Praveen
Can someone reccomend me a data structure pdf?
https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.docdroid.net/ZPfHmS5/data-structures-and-algorithms-narasimha-karumanchi-pdf&ved=2ahUKEwihne7ky8T0AhUSxzgGHbM9AwgQFnoECAQQAQ&usg=AOvVaw2FAf3TvI4Ol808kPk8ev5p
Anonymous
C programming basic coding questions for coding test please any examples for test tomorrow is my coding test
Arnold
Someone invited me to a crypto scam group from this group
Arnold
Be careful guys
Apk
klimi
Someone invited me to a crypto scam group from this group
This sadly happens and it's impossible to deal with it... :( as mentioned... it is best to set your privacy settings to not allow this adding
STRANGER
Can someone send me algorithm to find square root of a number step by step plz
Jay
Can someone send me algorithm to find square root of a number step by step plz
Square of a number n Of every number (i) in the range Of (limit of your choice ,probably 0) to (n) If ( i ** i ) == abs( n ) Then That's the square root Else It's not!
Hisco
Yeah am agree
\Device\NUL
Yeah am agree
Click the button
shady
Hello I am trying to learn c++ language
shady
Is there anyone (from egypt would be preferable) can help me start learning?
Ram
Hello I am trying to learn c language Can anyone help me
Pavel
Hello I am trying to learn c language Can anyone help me
You can ask specific questions and if someone can answer the questions they usually answer, that's how it usually works.
Ram
Ok thank you
Azhar
int *ptr = & arr[2] Means third element of array?
Azhar
int *ptr = & arr[2] Means third element of array?
Also asked with it that ptr = arr than value of ptr
Azhar
Explain lil bit anyone
Talula
int *ptr = & arr[2] Means third element of array?
& means to get the address of so what you're doing is telling that integer pointer with (int *p) is pointing to address of a[2]... which is 3rd element as C starts with 0 element as first one.
Talula
Also asked with it that ptr = arr than value of ptr
If you say int p = arr[2]; then it means you're making variable p and making it equal to arr's 3rd element.
Talula
It means the same other than first if pointing to the address of 3rd element and second is actually storing the value of 3rd element.
Azhar
It means the same other than first if pointing to the address of 3rd element and second is actually storing the value of 3rd element.
So overall means that now my 1st element is the third as pointer address the third element earlier.. Is it?
Pavel
So overall means that now my 1st element is the third as pointer address the third element earlier.. Is it?
You mean if you do this, that you've mentioned before? int *ptr = & arr[2]; ptr = arr you will just reassign the pointer in this case, ptr will point to the beginning of the array (first element), but nothing inside the array will be changed
Pavel
You can think of pointers as just normal variables that store addresses to the memory
Azhar
Like arr[10] = { some } Now *ptr = & arr[2] Now asking that ptr = arr.. What the value of ptr
Azhar
Im not getting the question part.. Now my value changed to third element?
⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠
So overall means that now my 1st element is the third as pointer address the third element earlier.. Is it?
The arrangement remains in the same place, just your pointer is pointing to the 3rd element. Also you can access the first element with minus index int *ptr = & arr[2]; //ptr[-2] is pointing to arr[0]
Azhar
Ok ok.. But if again saying ptr = arr means the address same? For which element
⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠
Azhar
int arr[n]; arr is basically an address
So here ptr is addressing the 1st element or whole array?
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
So here ptr is addressing the 1st element or whole array?
ptr would be addressing the address of the first element
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
int *ptr = & arr[2] Means third element of array?
And this means ptr is storing the address of the 3rd element
Aze
Hello pls who has a pdf copy of this book" design and evolution of c" should pls send it to my dm..
Azhar
And this means ptr is storing the address of the 3rd element
Bro exactly now what will be the value of ptr if ptr=arr?
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Bro exactly now what will be the value of ptr if ptr=arr?
arr itself is an address to the first element arr is the same as &arr[0]
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Bro exactly now what will be the value of ptr if ptr=arr?
So if ptr = arr Then ptr will hold the address of arr[0]
Azhar
And this means ptr is storing the address of the 3rd element
But u said nh that ptr is now addressing to third element.. So my ptr = arr should adress to third element nh(as now 3rd element is 1st for ptr)
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Like arr[10] = { some } Now *ptr = & arr[2] Now asking that ptr = arr.. What the value of ptr
No ptr will have address of third element if you do this int *ptr = &arr[2]
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Azhar
Don’t get you
Can i message you that question?
ɛ n h ᴀ n c ɛ ґ 🧟‍♂️
Can i message you that question?
👍🏼 I’ll help if i can
A. R.
Can someone send me algorithm to find square root of a number step by step plz
Here, take a look at this: https://en.m.wikipedia.org/wiki/Methods_of_computing_square_roots
Ram
Hello Which is the beat youtude channel for u
Ram
Thank you
Anonymous
Could u suggest me a compiler i can use from my mobile
Anonymous
Suggest me a c program to write output as 1 11 111 1111 11111
Talula
Suggest me a c program to write output as 1 11 111 1111 11111
int main() { printf("1\r\n"); printf("11\r\n"); printf("111\r\n"); ... }
Talula
Shortcut😅
That is a long cut, because the program would be longer... otherwise you could just use loop.
Buffer
Suggest me a c program to write output as 1 11 111 1111 11111
int main() { int i, x=1; for(i=0;i<5;i++) printf("%d\n", x) ; x=x*10 +1; return 0; }
Suka
Suggest me a c program to write output as 1 11 111 1111 11111
for(int i=1;i<10;i++) printf("%.*s\n",i,"111111111111111"); https://stackoverflow.com/questions/14678948/how-to-repeat-a-char-using-printf
Azhar
Allocatememory(int*, int)
Juli
Guys
Juli
I need your help fast pls
Juli
Who can help me
Juli
#include <iostream> using namespace std; int main(void) { const int N = 10; int arrayOfIntegers[N]; std::cout << "You will be prompt to enter 10 integer numbers " << endl; int counter = 0; while ( counter < N ) { // while loop begins std::cout << "Please enter an integer number " << endl; cin >> arrayOfIntegers[counter]; counter++; }// while loop ends int max = arrayOfIntegers[0]; /// compute min of data (begin) for (int i=0; i < N; i++) { // for loop begins if( arrayOfIntegers[i] > max ) max = arrayOfIntegers[i]; } // for loop ends /// compute min of data (end) std::cout << "The maximum of the values you have entered is: " << max << endl; return 0; } // end of main
Juli
#include <iostream> #include <stdlib.h> using namespace std; #define N 10 int main (void) { // beginning of main int arrayToSum[N]; cout << "You will be prompt to enter 10 positive integer numbers" << endl; // load numbers (begins) int number = 0; for (int i = 0; i < N; i++ ) { // for loop begins cout << "Please enter a positive integer number " << endl; cin >> number; if ( number > 0 ) { // if arrayToSum[i] = number; } // if else if ( number < 0 ) { // else if cout << "The number you have entered is negative " << endl; arrayToSum[i] = 0; continue; // else if } else if ( number == 0 ) { // else if cout << "The number you have entered is zero " << endl; arrayToSum[i] = 0; continue; // else if } } // for loop ends // load numbers (ends) // sum numbers (begins) int i = 0; int sum = 0; while( i < N ) { // while loop sum += arrayToSum[i]; i++; } // while loop // sum numbers (ends) if ( sum == 0 ){ cout << "You have entered all negative numbers or zeros" << endl; } else { cout << "The sum of the positive numbers is: " << sum << endl; } int max = arrayToSum[0]; /// compute max of data (begin) for (int i=0; i < N; i++) { // for loop begins if( arrayToSum[i] > max ) max = arrayToSum[i]; } // for loop ends /// compute min of data (end) if ( sum == 0 ){ cout << "You have entered all negative numbers or zeros" << endl; } else { std::cout << "The maximum of the values you have entered is: " << max << endl; } return 0; } // end of main
Juli
I need to make 3 combinations with these programs
Juli
#include <iostream> #include <cstdlib> #include <ctime> #include <stdlib.h> using namespace std; int main (void) { // beginning of main int num; int guess = 0; bool done; // https://stackoverflow.com/questions/33380282/how-does-rand-work-in-c time_t t; // srand Intializes random number generator */ srand((unsigned) time(&t)); num = rand() % 10; /* random numbers from 0 to 10 */ // integer reminder of the division by 10 // https://stackoverflow.com/questions/33380282/how-does-rand-work-in-c done = false; while (!done) { cout << "Enter an integer greater " << "than or equal to 0 and " << "less than 10: "; cin >> guess; cout << endl; if ( guess >=0 && guess <=10 ) { // proceed if (guess == num) { cout << "You guessed the correct " << "number." << endl; done = true; } else if (guess < num) cout << "Your guess is lower " << "than the number " << "Guess again!" << endl; else cout << "Your guess is higher " << "than the number " << "Guess again!" << endl; } else { cout << "The number must be in the range [0, 10] " << endl; break; } } // end of while loop return 0; } // end of main
Juli
#include <iostream> #include <stdlib.h> using namespace std; #define N 10 int main (void) { // beginning of main int arrayOfIntegers[N] = {0, 2, 7, 99, 55, 44, 23, 17, 19, 1}; int searchItem; cout << "For the number you enter, the program will perform " << endl; cout << "sequential search in the array stored in memory" << endl; cout << "Please enter an integer" << endl; cin >> searchItem; bool found = false; int storeLocation=-1; int searchResult=-1; for (int i = 0; i < N; i++) { // for loop begins if ( arrayOfIntegers[i] == searchItem ) { found = true; storeLocation = i; break; } else{ found = false; } } // for loop ends if ( found == true ) { // if cout << "The requested item: " << searchItem << " is found at location: " << storeLocation << endl; cout << "in the array stored in memory" << endl; } // if else if ( found == false ) { // else cout << "The requested item cannot be found" << endl; } // else // part I - ends return 0; } // end of main