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
WARRIOR [948]
2 years ago
14

Define a structure Triangle that contains three Point members. Write a function that computes the perimeter of a Triangle . Writ

e a program that reads the coordinates of the points, calls your function, and displays the result
Computers and Technology
1 answer:
qwelly [4]2 years ago
7 0

Answer:

The program in C++ is as follows:

#include <iostream>    

using namespace std;

int perimeter(int side1, int side2, int side3){

return side1+side2+side3;

}

struct Triangle  {

int side1;  int side2;   int side3;

};

int main(void) {

int side1, side2, side3;

cout<<"Sides of the triangle: ";

cin>>side1>>side2>>side3;

struct Triangle T;

T.side1 = side1;

T.side2 = side2;

T.side3 = side3;  

cout << "Perimeter: " << perimeter(T.side1,T.side2,T.side3) << endl;

return 0;

}

Explanation:

See attachment for complete code where comments are as explanation

Download cpp
You might be interested in
Whether you work in m-commerce, e-commerce, or brick-and-mortar commerce, to be successful you will need to be able to think cri
svlad2 [7]

Answer:

The answer is "Option c"

Explanation:

Decisions made in secret have always been critical. Hence the want to express it before your choice is made. It is all about how you express choice. In general, they need your presentation to explain the choice that you decided, how they created it, and how it implies for just the group, that you are approaching, and wrong choices can be described as follows:

  • In option a, It is used in the industry to interest.
  • In option b, It is use in communication mechanism.
  • In option d, It enables people to handle our activities or carry them out.
3 0
2 years ago
Programs for embedded devices are often written in assembly language. Some embedded processors have limited instructions, like M
oksano4ka [1.4K]

Answer:

#include <iostream>

using namespace std;

int main()

{

   char address[2];

   int tag, firstBit, secondBit, setNumber;

   int cache[4][2]={{1,5}, {2,4}, {3,2}, {6,0}};

   cout << "Enter the address as hex(in small letters: "<

   cin >> address;

   for (int i < 0; i < 8; i++){

       if (address[0] == '0'){

           tag = 0;

           firstBit = 0;

        } else if (address[0] == '1'){

           tag = 0;

           firstBit = 1;

        } else if (address[0] == '2'){

           tag =1;

           firstBit = 0;

        } else if (address[0] == '3'){

           tag = 1;

           firstBit = 1;

        } else if (address[0] == '4'){

           tag = 2;

           firstBit = 0;

        } else if (address[0] == '5'){

           tag = 2;

           firstBit = 1;

        }  else if (address[0] == '6'){

           tag = 3;

           firstBit = 0;

       } else if (address[0] == '7'){

           tag = 3;

           firstBit = 1;

       }  else if (address[0] == '8'){

           tag = 4;

           firstBit = 0;

       } else if (address[0] == '9'){

           tag = 4;

           firstBit = 1;

       }   else if (address[0] == 'A'){

           tag = 5;

           firstBit = 0;

       } else if (address[0] == 'B'){

           tag = 5;

           firstBit = 1;

       }  else if (address[0] == 'C'){

           tag = 6;

           firstBit = 0;

       } else if (address[0] == 'D'){

           tag = 6;

           firstBit = 1;

        }  else if (address[0] == 'E'){

           tag = 7;

           firstBit = 0;

       } else if (address[0] == 'F'){

           tag = 7;

           firstBit = 1;

       } else{

           cout<<"The Hex number is not valid"<< endl;

        }

   }

   if(address[1]>='0' && address[1]<'8'){

       secondBit = 0;

  }  else if(address[1]=='8'|| address[1]=='9'||(address[1]>='a' && address[1]<='f')){

       secondBit = 1;

   }  else{

       cout<<"The Hex number is not valid"<< endl;  

       return 0;

   }

   setNumber = firstBit * 2 + secondBit;

   if(cache[setNumber][0]==tag || cache[setNumber][1]==tag){

       cout<<"There is a hit";

   } else{

       cout<< "There is a miss";

   }

   return 0;

}

Explanation:

The C++ source code prompts the user for an input for the address variable, then the nested if statement is used to assign the value of the firstBit value given the value in the first index in the address character array. Another if statement is used to assign the value for the secondBit and then the setNumber is calculated.

If the setNumber is equal to the tag bit, Then the hit message is printed but a miss message is printed if not.

4 0
2 years ago
•Should other states wait to see if the high-speed rail system works well before starting their own plans for similar systems?
solmaris [256]
Other states should see how well the system works and also understand how much money it requires for the state to build a high-speed rail system.
7 0
3 years ago
5. The problem domain refers to the
solong [7]

Answer:

The problem domain refers to the support options.

6 0
2 years ago
Formulas should follow the___
tatuchka [14]

Answer:

Order of operations

Explanation:

4 0
2 years ago
Other questions:
  • Stefan is finalizing his presentation by adding media files and preparing it for distribution. Stefan knows that saving a presen
    13·1 answer
  • Does anyone have any social media message me
    14·1 answer
  • Write a program that asks the user to enter a whole number then outputs a 0 if the number is even or a 1 if the number is odd. (
    14·1 answer
  • Implement the RC4 stream cipher in C++. User should be able to enter any key that is 5 bytes to 32 bytes long. Be sure to discar
    7·1 answer
  • In 2d design, form makes what possible?
    15·1 answer
  • You need to replace a broken monitor on a desktop system. You decide to replace it with a spare monitor that wasn't being used.
    15·2 answers
  • How do you write a multiplication formula in excel with an absolute refrence?
    11·1 answer
  • Something I should look for when trying to decide if a source is credible is the publication's ....
    10·1 answer
  • What is an automatic update and when should you use it
    10·1 answer
  • Design a circuit that will tell whether a given month has 30 days in it.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!