fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void removeS(char msg[]){
  5. for(char* ptr = msg; *ptr != 0; ptr++){
  6. if(*ptr == 's' || *ptr == 'S'){
  7. for(;*ptr != 0; ptr++){
  8. *ptr = *(ptr+1);
  9. }
  10. ptr = msg;
  11. }
  12. }
  13. }
  14.  
  15. int main()
  16. {
  17. //Declare a pointer variable named cat that can point to a variable of type double.
  18. double* cat;
  19. //Declare mouse to be a 5-element array of doubles.
  20. double mouse[5];
  21. //Make the cat variable point to the last element of mouse.
  22. cat = mouse+4;
  23. //Make the double pointed to by cat equal to 42, using the * operator.
  24. *cat = 42;
  25. //Without using the cat pointer, and without using square brackets, set the fourth element (i.e., the one at position 3) of the mouse array to have the value 25.
  26. *(mouse+3) = 25;
  27. //Move the cat pointer back by three doubles.
  28. *cat -= 3.0;
  29. //Using square brackets, but without using the name mouse, set the third element (i.e., the one at position 2) of the mouse array to have the value 17.
  30. cat[1] = 17;
  31. //Without using the * operator, but using square brackets, set the double pointed to by cat to have the value 54.
  32. cat[0] = 54;
  33. //Using the * operator in the initialization expression, declare a bool variable named b and initialize it to true if the double pointed to by cat is equal to the double immediately following the double pointed to by cat, and false otherwise.
  34. bool b = *cat == *(cat+1);
  35. //Using the == operator in the initialization expression, declare a bool variable named d and initialize it to true if cat points to the double at the start of the mouse array, and false otherwise.
  36. bool d = cat == mouse;
  37. }
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty