Git Product home page Git Product logo

assignment6's Introduction

Assignment6

Objectives

To gain a solid understanding of structures and enums.

Part 1

  1. Write a program, banking.c, that uses structures to represent a bank account. Accounts should have an account number, name, and balance. Create functions to deposit or withdraw money from the balance. Write a driver that creates 2 accounts, adds money to each, then withdraws money from each. Print details of the account between each transaction.

  2. Write a program, complex.c, that implements complex numbers as a structure and allows a user to perform calculations with them. Your structure should only contain the real and imaginary portions of a complex number. Create functions to add, subtract, multiply, divide and display complex numbers. Allow the user to select what functions they want to use (much like your calculator.c programs from last week) and enter the complex numbers they want to perform calculations with.

  3. Submit the code computing the student average that we worked on it class.

Part 2

In a text file assignment6.txt, answer the following questions:

  1. What will be output of following C code? Explain your answer.
int main() {
  struct employee
  {
    unsigned int id = 8;
    unsigned int sex = 1;
    unsigned int age = 7;
  };
  struct employee emp1={203,1,23};
  clrscr();
  printf("%d\t%d\t%d",emp1.id,emp1.sex,emp1.age);
  getch();
}
  1. How are structures and enumerations similar and different? Give an example of when you would use each.

  2. Explain the difference between passing an array directly to a function versus passing a structure containing an array?

Submission Guidelines

Please include your name and a description in a comment at the top of your code files. Please also include your name at the top of your assignment6.txt file.

All files must be submitted via GitHub by 10:00am 7/7.

assignment6's People

Contributors

jrosen081 avatar clesleycode avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.