[SOLVED] CPE325-Embedded Systems Lab1

25.99 $

Category:

Description

Rate this product
  1. Write a program in C where you would perform the following tasks:
    1. Declare a integer variable a whose value is 15, and another integer p whose value is 5.
    2. Make a call to function myPower() whose arguments are the integer value a and power value p. This function should return an integer value which you will assign to another integer value b which should be equal to a raised to p.
      1. You need to write your own function myPower()
      2. Ask your instructor how to write a function in C. iii. Do not use standard C function that calculates power. Instead write your own for loop that calculates power.
      3. Print a statement that looks similar to the following replacing a, p and b with their respective values.

a raised to the power p is b

  1. Write a C program to count the number of symbols that represent mathematical operations in a string. Mathematical operations include %, &, *, +, -, /, <, >, =, ^ and ~. You can define the string in your program as a character array. For demonstration purpose, your output should exactly look like following.

String: Do 42+53/76%8=2*8-32+71 & you can sleep. Contains: The string contains 8 symbols that represent mathematical operations.

Deliverables

  1. Lab report which includes:
    1. Flowchart
    2. Output screenshots if any
  2. Source files (.c files)

Note: 

  1. You must create an organized directory, subdirectory, workspace, and project for each demo code and each solution.
  2. During demonstration, you should be able to inspect variables, set watchpoints, set and monitor breakpoints, monitor registers and memory, and show the output.
  3. Before concluding which solution is better in part 1, make sure to test with different input sets.