1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sergeu [11.5K]
3 years ago
11

In mathematics, "quadrant I" of the cartesian plane is the part of the plane where x and y are both positive. Given a variable,

p that is of type POINT-- a structured type with two fields, x and y, both of type double-- write an expression that is true if and only if the point represented by p is in "quadrant I".
Computers and Technology
1 answer:
lbvjy [14]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

struct Cartesian {

double x;

double y;

};

int main() {

// creating a pointer p of type struct Cartesian

struct Cartesian *p = new Cartesian ;

cout << " Enter x: ";

// accessing the structure variable x by arrow "->"

cin >> p->x;

cout << "Enter y: ";

// accessing the structure variable y by arrow "->"

cin >> p->y;

// expression to check whether x and y lie in Quadrant 1

if (p->x > 0 && p->y > 0) {

 cout << "X and Y are in Quadrant 1 ";

}

else

{

 cout << "x And y are not in Quadrant 1";

}

// deleting the struct pointer p

delete p;

return 0;

}

Explanation:

in order to locate memory in heap, keyword "new" is used in C++ so,

struct Cartesian *p = new Cartesian ;

in order to access data members of the structure using pointer we always use an arrow "->". otherwise a dot oprerator is used to access data members.

in order to check whether x and y lie in 1st quadrent, we must use && operator in our if condition. so

if (p->x > 0 && p->y > 0)

&& will return true iff x and y both are +ve.

deleting the struct pointer p is important beacuse we are allocating memory in heap so heap memory should be used a resource and must be release when not needed otherwise it can cause memory leakage problems. so  

delete p;

You might be interested in
"3. 4. Simple number search We will pass you 2 inputs an list of numbers a number, N, to look for Your job is to loop through th
Arisa [49]

Answer:

Following is given the detailed solution to the question given.

  • First image contains source code. All the steps are described with help of comments.
  • Second image contains the output or the program given.

I hope it will help you!

Explanation:

4 0
3 years ago
What do u do to me pepa
Maru [420]
Peppa: Hello Susie!

Susie: *mehhh* Hello Peppa!
What are you doing?
Peppa: I'm learning to whistle,

but I can't do it yet.
Susie: Hmm.. that sounds hard.
Peppa: It's impossible!
Uh.. can you whistle Susie?
Susie: No

Peppa: *honk* Oh good! I mean-
that's sad if you can't whistle

but good because I can't whistle

Susie: What's whistling anyway?
Peppa: You put your lips together
and blow!
Susie: Like this? *whistles*
8 0
2 years ago
Hardware failure, power outages, and DOS attacks will affect:
const2013 [10]

Answer:

The answer should be data availability

6 0
2 years ago
Whers the main characteristic of a Peer-to-peer (P2P) network?
ioda

The answer to this would be B

5 0
3 years ago
Write a C program that spins a child process. The child process reads a number from the keyboard and passes the number on to the
Murrr4er [49]

# include <stdio.h>

int main()

{    

   int pid;

   pid=getpid();

   printf(\"Current Process ID is : %d\\n\",pid);

   printf(\"[ Forking Child Process ... ] \\n\");    

   pid=fork(); /* This will Create Child Process and

              Returns Child\'s PID */

   if(pid < 0)

   {

       /* Process Creation Failed ... */

       exit(-1);

   }

   else if(pid==0)  

   {

       /* Child Process */

       printf(\"Child Process Started ...\\n\");

       printf(\"Child Process Completed ...\\n\");

   }

   else  

   {

       /* Parent Process */

       sleep(10);

       printf(\"Parent Process Running ... \\n\");

       printf(\"I am In Zombie State ...\\n\");

       while(1)

       {

           /*  

               Infinite Loop that Keeps the

                  Process Running

           */

       }

   }    

   return 0;

}

# include <stdio.h>

int main()

{    

   int pid;

   pid=getpid();

   printf(\"Current Process ID is : %d\\n\",pid);

   printf(\"[ Forking Child Process ... ] \\n\");    

   pid=fork(); /* This will Create Child Process and

              Returns Child\'s PID */

   if(pid < 0)

   {

       /* Process Creation Failed ... */

       exit(-1);

   }

   else if(pid==0)  

   {

       /* Child Process */

       printf(\"Child Process Started ...\\n\");

       printf(\"Child Process Completed ...\\n\");

   }

   else  

   {

       /* Parent Process */

       sleep(10);

       printf(\"Parent Process Running ... \\n\");

       printf(\"I am In Zombie State ...\\n\");

       while(1)

       {

           /*  

               Infinite Loop that Keeps the

                  Process Running

           */

       }

   }    

   return 0;

}

4 0
3 years ago
Other questions:
  • WordArt styles allow you to add ____.
    9·1 answer
  • After a normal system shutdown, when the computer is turned off, contents of the memory used to store bios settings are
    12·2 answers
  • Which of the following is CORRECT about database managementsystem's languages?
    6·1 answer
  • 12. Kelly would like to know the average bonus multiplier for the employees. In cell C11, create a formula using the AVERAGE fun
    7·1 answer
  • Social media is a type of ___________ ccommunication (type either push or pull for your response).
    8·2 answers
  • Given the following schedule, show the locks that will occur and the subsequent schedule. Assume that strict 2PL is in effect, w
    13·1 answer
  • A connection between files that allows data to be transferred from one file to another is a _______________________.
    6·1 answer
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
  • Write a one page report describing the computer the client used, who else had access to it and other relevant findings. Referenc
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!