InterviewSolution
| 1. |
*️⃣ Write a program to calculate three side of SI using structure with array. *️⃣ *️⃣ Question of C++ *️⃣‼️ Spammers be away ‼️ |
|
Answer» re in C++We have ALREADY dealt with arrays. Arrays are used to store SIMILAR TYPE of data. Have you ever thought if there is any way to store dissimilar data?The answer is yes. We use structures to store different types of data. For example, you are a STUDENT. Your name is a string and your phone number and roll_no are integers. So, here name, address and phone number are those different types of data. Here, structure comes in the picture.Defining a StructureThe syntax for structure is:STRUCT structure_name{data-type member-1;data-type member-2;data-type member-3;data-type member-4;};In our case, let's name the structure as student. The members of the structure in our case are name, roll_no and phone_number.So, our structure will look like:struct student{ int roll_no; std::string name; int phone_number;};thank you .@chetan2222 |
|