Looking for Methodology and Programming Techniques 1, Laboratory 2025 test answers and solutions? Browse our comprehensive collection of verified answers for Methodology and Programming Techniques 1, Laboratory 2025 at upel.agh.edu.pl.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
1. Create a library with a function that calculates the sum of the squares: 1*1 + 2*2 + 3*3 + 4*4 +...+ N*N
2. In main() use the function from the library to print the sum of squares for N = 3, 5 and 10.
In your answer, separate each file with the following delimiters:
// BEGIN file1_name
file1 content
// END file1_name
// BEGIN file2_name
file2 content
// END file2_name
// BEGIN file3_name
file3 content
// END file3_name
1. Create a structure Car with the following elements - two array pointers, one for position x and one for position y. - one variable to store the car id. - one variable to store the number of movement steps of the car. 2. Create an array of structures of type Car for 5 cars. For each car, reserve memory to store 1000 positions using the operator new. 3. Set the position of the car with the following formula car_position_x_now = car_position_x_previous + (car_id+1)*0.5 car_position_y_now = car_position_y_previous - (car_id+1)*0.5 4. Print the last position of each car and free the positions' arrays from memory using the operator delete. Use the following code as an example:
1- Calculate the sum of the array’s elements.
2- Find the greatest and smallest elements of an array.
3- Sort the first half of the array in descending order and the second half in ascending order.
Test your code with examples and print the results on the screen.
```
| day
exp | 1 2 3 4
----+---------------------
1 | 7.3 5.6 6.5 6.3
2 | 3.3 4.1 2.7 1.8
3 | 7.0 5.1 5.5 5.3
```
* Complete the program with an array of 5 columns and 3 rows.
* Initialize it with the data in columns 1 to 4.
* In column 5, calculate the mean (average) temperature of every experiment.
* Print the averages of each experiment to the screen.
* Print the higher temperature to the screen.
Write a code that implements a logic XNOR gate, using conditionals, given two inputs A and B, obtain the output C = A XNOR B:
XNOR LOGIC GATE
-------------------------
Input | Output
-------------------------
A | B | C = A XNOR B
-------------------------
0 | 0 | 1
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1
-------------------------
Create a structure for a supermarket product, for example:
name product_1
weight 1.0
price 20
Name is of type string, weight is of type float and price is of type int.
Please complete the program with one product and print the information of the product to the standard output.
The output of the following code is
#include <iostream>
using namespace std;
int main(){
int x = 4;
int y = -5;
cout << ((y > 3) && (x < 5)) << endl;
return EXIT_SUCCESS;
}