Free Essay

Design a Program That Will Allow a User to Input a List of Your Family Members Along with Their Age and State Where They Reside C-Code

In:

Submitted By bert5290
Words 313
Pages 2
#include <stdio.h>

//Declare Prototype float getavg(int ageSum, int n);

int main()
{
//Define variable family as number of loops and i as counter int family, i;

printf("Enter the number of family members being submitted:"); scanf("%d", &family); //Declare rest of variables to hold the family names,states, ages, the sum of their ages, and the average of their ages char familynames[family][30], familystate[family][30]; int familymemberages[family], sum = 0; float averageAge;

//Start loop and counter

for (i=0; i < family; i++) { printf("\nPlease enter the following details for family member: \n" ); //Ask user to input first name printf("First name: "); scanf("%s", familynames[i]); //Store name in familynames //Ask user to input age printf("Age (in years): "); scanf("%d", &familymemberages[i]); //Store age in familymemberages //Ask user to input state they reside in printf("State of residence (by Abbreviation; Pa,Ny, Tx, etc...): "); scanf("%s", familystate[i]); //Store state in familystate //Sum of ages adding of all familymemberages sum += familymemberages[i]; } //Define the average age averageAge = getavg(sum, family); //Display the average age printf("\n\nThe average age among your family members is %.2f years\n", averageAge); //Display the list of members in Tx printf("List of members who live in Texas are: \n"); //Compare each charactors in string for Tx for (i=0; i<family; i++) { if ((familystate[i][0]=='T')&&(familystate[i][1]=='x')) { printf("Name: %s\n", familynames[i]); printf("Age: %d\n", familymemberages[i]); } else { //If no members are found or there are no more display //Wanted to display you have no more members in Tx if there was at least one, but no time printf("You have no relatives in Tx.\n"); } }

return 0;
}
//Forces function to return a value float getavg(int ageSum, int n)

{ //Forced function value return (ageSum*1.0)/n;
}

Similar Documents

Free Essay

Student

...President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written...

Words: 142312 - Pages: 570

Free Essay

Concepts of Programming Languages

...Snider Vice President and Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Senior Production Project Manager: Marilyn Lloyd Manufacturing Manager: Nick Sklitsis Operations Specialist: Lisa McDowell Cover Designer: Anthony Gemmellaro Text Designer: Gillian Hall Cover Image: Mountain near Pisac, Peru; Photo by author Media Editor: Dan Sandin Full-Service Vendor: Laserwords Project Management: Gillian Hall Printer/Binder: Courier Westford Cover Printer: Lehigh-Phoenix Color This book was composed in InDesign. Basal font is Janson Text. Display font is ITC Franklin Gothic. Copyright © 2012, 2010, 2008, 2006, 2004 by Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Manufactured in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education,...

Words: 142253 - Pages: 570

Premium Essay

Computer

...the importance of computer literacy. 2. Define the term computer. 3. Identify the components of a computer. 4. Compare the uses of various types of: input devices, output devices, and storage devices. 5. Describe categories of computers and their uses. Structure and Functions of a Computer 1 1.0 Introduction A computer is an electronic machine designed for the storage and processing of data. The machinery is called hardware, and this highly sophisticated equipment needs equally sophisticated programs (called software) to become a working computer system. Modern society has come to depend very heavily on the use of computer systems. Banks, businesses, government departments, industries, shops, people at home and school all rely on computer to play a vital role in their daily activities. These activities are centered on information. In business, the computer system has been used a lot and replaced filing cabinets as means of storing information, and clerical workers as a means of processing it. By storing and processing information on a computer system, these businesses can function more quickly and efficiently, because information can be found and collated much faster. Discovery Learning: A computer was also called a data processor. Why? 1.1 Major Parts and Functions A Computer is an electronic device that accepts input data, processes data, stores data and produces output into useful information. Data is a collection of raw unprocessed facts, figures and symbols....

Words: 47755 - Pages: 192

Premium Essay

Teach Yourself Sql

...Day 13 Advanced SQL Topics Day 14 Dynamic Uses of SQL Week 2 in Review Week 3 at a Glance Day 15 Streamlining SQL Statements for Improved Performance Day 16 Using Views to Retrieve Useful Information from the Data Dictionary Day 17 Using SQL to Generate SQL Statements Day 18 PL/SQL: An Introduction Day 19 Transact-SQL: An Introduction Day 20 SQL*Plus Day 21 Common SQL Mistakes/Errors and Resolutions Week 3 in Review Appendixes A Glossary of Common SQL Statements B Source Code Listings for the C++ Program Used on Day 14 C Source Code Listings for the Delphi Program Used on Day 14 D Resources E ASCII Table F Answers to Quizzes and Excercises © Copyright, Macmillan Computer Publishing. All rights reserved. Teach Yourself SQL in 21 Days, Second Edition Acknowledgments A special thanks to the following individuals: foremost to my loving wife, Tina, for her tolerance and endless support, to Dan Wilson for his contributions, and to Thomas McCarthy at IUPUI. Also, thank you Jordan for your encouragement over the past few years. -- Ryan K. Stephens Special thanks to my wife for putting up with me through this busiest of times. I apologize to my mom for not seeing her as often as I should (I'll make it up to you). Also, thanks to my loyal dog, Toby. He was with me every night and wouldn't leave my side....

Words: 128515 - Pages: 515

Premium Essay

Pc Security

...Internet Web site references, is subject to change without notice. Unless otherwise noted, the example companies, organizations, products, domain names, e-mail addresses, logos, people, places and events depicted herein are fictitious, and no association with any real company, organization, product, domain name, e-mail address, logo, person, place or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft, MS-DOS, Windows, Windows NT, Active Directory, BizTalk, IntelliSense, MSDN, Visual Basic, Visual C#, Visual C++, and Visual Studio are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. © 2003 Microsoft Corporation. All rights reserved. Version 1.0 6/30/2003 The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Contents Forewords xliii Foreword by Mark Curphey .....................................................................................xliii...

Words: 83465 - Pages: 334

Premium Essay

Imformation Systems Teach Yourself Sql

...Statements for Improved Performance Day 16 Using Views to Retrieve Useful Information from the Data Dictionary Day 17 Using SQL to Generate SQL Statements Day 18 PL/SQL: An Introduction Day 19 Transact-SQL: An Introduction Day 20 SQL*Plus Day 21 Common SQL Mistakes/Errors and Resolutions Week 3 in Review Appendixes A Glossary of Common SQL Statements B Source Code Listings for the C++ Program Used on Day 14 C Source Code Listings for the Delphi Program Used on Day 14 D Resources E ASCII Table F Answers to Quizzes and Excercises / Copyright, Macmillan Computer Publishing. All rights reserved. Join the National Guard Car Computer Serve in your own backyard Get Free Info Here. No Obligation www.military.com Complete Diagnostic Software Tool DTC Codes, Sensor Readings & More! www.digimoto.com Teach Yourself SQL in 21 Days, Second Edition Acknowledgments A special thanks to the following individuals: foremost to my loving wife, Tina, for her tolerance and endless support, to Dan Wilson for his contributions, and to Thomas McCarthy at IUPUI. Also, thank you Jordan for your encouragement over the past few years. -- Ryan K. Stephens Special thanks to...

Words: 129252 - Pages: 518

Premium Essay

Analysis

...SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C This page intentionally left blank SEVENTH EDITION PROBLEM SOLVING AND PROGRAM DESIGN in C Jeri R. Hanly, University of Wyoming Elliot B. Koffman, Temple University Boston Columbus Indianapolis New York San Francisco Upper Saddle River Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo Editorial Director, ECS: Marcia Horton Editor-in-Chief: Michael Hirsch Senior Project Manager: Carole Snyder Director of Marketing: Patrice Jones Marketing Manager: Yezan Alayan Senior Marketing Coordinator: Kathryn Ferranti Director of Production: Vince O’Brien Managing Editor: Jeff Holcomb Associate Managing Editor: Robert Engelhardt Production Manager: Pat Brown Creative Director: Jayne Conte Designer: Suzanne Behnke Media Editor: Daniel Sandin Media Project Manager: John Cassar Cover Image: (c) michael Holcomb/Shutterstock.com Full-Service Project Management: Mohinder Singh/ Aptara®, Inc. Composition: Aptara®, Inc. Printer/Binder: Edwards Brothers Cover Printer: Lehigh-Phoenix Credits and acknowledgments borrowed from other sources and reproduced, with permission, in this textbook appear on appropriate page within text. Photo Credits: Page 4: Fig. 0.1: akg-images/Paul Almasy/Newscom. Page 11: Fig. 0.4: © 2008 IEEE/Journal of Microelectromechanical Systems (2006). Page 15:...

Words: 158087 - Pages: 633

Premium Essay

Computer Science Illuminated

...N E L L D A L E J O H N L E W I S illuminated computer science J O N E S A N D B A RT L E T T C O M P U T E R S C I E N C E computer science illuminated N E L L D A L E J O H N L E W I S computer science illuminated N E L L D A L E J O H N Villanova University L E W I S University of Texas, Austin Jones and Bartlett Publishers is pleased to provide Computer Science Illuminated’s book-specific website. This site offers a variety of resources designed to address multiple learning styles and enhance the learning experience. Goin’ Live This step-by-step HTML Tutorial will guide you from start to finish as you create your own website. With each lesson, you’ll gain experience and confidence working in the HTML language. Online Glossary We’ve made all the key terms used in the text easily accessible to you in this searchable online glossary. The Learning Store Jones and Bartlett Publishers has a wealth of material available to supplement the learning and teaching experience. Students and instructors will find additional resources here or at http://computerscience. jbpub.com The Language Library Here you will find two complete chapters that supplement the book’s language-neutral approach to programming concepts. A JAVA language chapter and C++ language chapter are included and follow the same pedagogical approach as the textbook. http://csilluminated.jbpub.com eLearning Our eLearning center provides chapter-specific...

Words: 67693 - Pages: 271

Premium Essay

Learning C#

...Learning C# 3.0 Other resources from O’Reilly Related titles oreilly.com C# 3.0 Cookbook™ C# 3.0 Design Patterns C# 3.0 in a Nutshell Programming ASP.NET 3.5 Programming C# 3.0 Programming .NET 3.5 Programming WCF Services Programming WPF oreilly.com is more than a complete catalog of O’Reilly books. You’ll also find links to news, events, articles, weblogs, sample chapters, and code examples. oreillynet.com is the essential portal for developers interested in open and emerging technologies, including new platforms, programming languages, and operating systems. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in documenting the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online reference library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or simply flip to the page you need. Try it today for free. Learning C# 3.0 Jesse Liberty and Brian MacDonald Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Learning C# 3.0 by Jesse Liberty and Brian MacDonald Copyright © 2009 Jesse Liberty and...

Words: 62585 - Pages: 251

Free Essay

Donald Miner Serves as a Solutions Architect at Emc Greenplum,

...www.it-ebooks.info MapReduce Design Patterns Donald Miner and Adam Shook www.it-ebooks.info MapReduce Design Patterns by Donald Miner and Adam Shook Copyright © 2013 Donald Miner and Adam Shook. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or corporate@oreilly.com. Editors: Andy Oram and Mike Hendrickson Production Editor: Christopher Hearse Proofreader: Dawn Carelli Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest December 2012: First Edition Revision History for the First Edition: 2012-11-20 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449327170 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. MapReduce Design Patterns, the image of Père David’s deer, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the...

Words: 63341 - Pages: 254

Free Essay

Examination

...Keys 6. Internet 7. Networking 8. DBMS 9. Programming Languages Miscellaneous 10. www.bankersadda.com | www.careerpower.in 16-17 Marks 3-4 Marks | www.sscadda.com Page 1 COMPUTER FUNDAMENTALS  A Computer is a general purpose device that can be programmed to carry out a set of arithmetic or logical operations automatically. Since a sequence of operations can be readily changed, the computer can solve more than one kind of problem.  A general purpose computer has four main components: the arithmetic logic unit (ALU), the control unit, the memory, and the input and output devices (collectively termed I/O).  The data that is fed into a computer processor received into the computer by a keyboard or other sources is called Input.  A computer is an electronic device that accepts data from the user (input), processes the data by www.bankersadda.com |     www.careerpower.in performing calculations and operations on it...

Words: 11667 - Pages: 47

Premium Essay

Introduction of Computer

...Kevin Tan Pooi Soo Content Writer: Ms. Parasathy Daivasigamani Instructional Designer: Ms. Jeanne Chow Academic Members: Mr. Chandarasageran a/l Natarajan and Mr. Ishan Sudeera Abeywardena COURSE COORDINATOR Mr. Kevin Tan Pooi Soo EXTERNAL COURSE ASSESSOR Associate Professor Norhaziah Md Salleh PRODUCTION Editor: Mr. Terence Too Yang-Yau In-house Editor: Ms. Jeanne Chow Graphic Designers: Ms. Patsy Yap and Ms. Leong Yin Ling Wawasan Open University is Malaysia’s first private not-for-profit tertiary institution dedicated to adult learners. It is funded by the Wawasan Education Foundation, a tax-exempt entity established by the Malaysian People’s Movement Party (Gerakan) and supported by the Yeap Chor Ee Charitable and Endowment Trusts, other charities, corporations and members of the public. The course material development of the university is funded by Yeap Chor Ee Charitable and Endowment Trusts. © 2008 Wawasan Open University First revision S1 2011 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without prior written permission from WOU. Wawasan Open University Jalan Sultan Ahmad Shah, 10050 Penang. Tel: (604) 2180333 Fax: (604) 2279214 Email: enquiry@wou.edu.my Website: www.wou.edu.my UNIT 1 C Introduction to computers Contents Unit 1 Introduction to Computers Course overview Unit overview Unit...

Words: 26839 - Pages: 108

Free Essay

Linux System Programming

...Understanding the Linux Kernel Linux Books Resource Center linux.oreilly.com is a complete catalog of O’Reilly’s books on Linux and Unix and related technologies, including sample chapters and code examples. ONLamp.com is the premier site for the open source web platform: Linux, Apache, MySQL and either Perl, Python, or PHP. Conferences O’Reilly brings diverse innovators together to nurture the ideas that spark revolutionary industries. We specialize in documenting the latest tools and systems, translating the innovator’s knowledge into useful skills for those in the trenches. Visit conferences.oreilly.com for our upcoming events. Safari Bookshelf (safari.oreilly.com) is the premier online reference library for programmers and IT professionals. Conduct searches across more than 1,000 books. Subscribers can zero in on answers to time-critical questions in a matter of seconds. Read the books on your Bookshelf from cover to cover or simply flip to the page you need. Try it today for free. LINUX System Programming Robert Love Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo Linux System Programming by Robert Love Copyright © 2007 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions...

Words: 125679 - Pages: 503

Free Essay

Core Concepts of Ais

...Kamins Sarah Vernon Jacqueline Kepping Dorothy Sinclair Erin Bascom Karolina Zarychta Harry Nolan Wendy Lai Laserwords Maine Anna Melhorn Elle Wagner Greg Chaput Maciej Frolow/Brand X/Getty Images, Inc. This book was set in 10/12pt Garamond by Laserwords Private Limited, and printed and bound by RR Donnelley/Jefferson City. The cover was printed by RR Donnelley/Jefferson City. This book is printed on acid free paper. Founded in 1807, John Wiley & Sons, Inc. has been a valued source of knowledge and understanding for more than 200 years, helping people around the world meet their needs and fulfill their aspirations. Our company is built on a foundation of principles that include responsibility to the communities we serve and where we live and work. In 2008, we launched a Corporate Citizenship Initiative, a global effort to address the environmental, social, economic, and ethical challenges we face in our business. Among the issues we are addressing are carbon impact, paper specifications and procurement, ethical conduct within our business and among our vendors, and community and...

Words: 241803 - Pages: 968

Premium Essay

Java

...Java 2 topics such as "servlets" and "Swing." As before, there's help with Java Beans and migrating from C++ to Java. A special chapter gives networking basics and breaks out networking-related classes. This book helps you master techniques by doing as well as reading. Projects include a multi-player word game with attention paid to network security. The book is updated where appropriate throughout, and the rhythm of text, code, tables, and illustrations is superb. It's a valuable resource for the developer who is elbow-deep in demanding projects. Table of Contents Java 2 Preface - 7 Part l The Java Language - The Complete Reference - 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 hapter 10 - The Genesis of Java - 9 - An Overview of Java - 20 - Data Types, Variables, and Arrays - 36 - Operators - 57 - Control Statements - 75 - Introducing Classes - 94 - A Closer Look at Methods and Classes - 111 - Inheritance - 134 - Packages and Interfaces - 156 - Exception Handling - 174 Chapter 11 - Multithreaded Programming - 188 Chapter 12 - I/O, Applets, and Other Topics - 214 Part ll The Java Library Chapter 13 - String Handling - 235 Chapter 14 - Exploring java.lang - 255 Chapter 15 - java.util Part 1: The Collections Framework - 297 Chapter 16 - java.util Part 2: More Utility Classes - 343 -2- Chapter 17 - Input/Output: Exploring java.io - 362 Chapter 18 - Networking - 397 Chapter 19 - The Applet...

Words: 78285 - Pages: 314