1) A design issue for names is:
a. Whether or not
names should be in English
b. Whether or not to have special words
c. Whether names are case sensitive
d. None of the above
2) Suppose we have defined a struct called person and we obtain the value of a field called height from a person using this syntax:
m->height
height is a double. What is the type of m?
a. pointer to a
double
b. either a pointer to a struct person or a void pointer
c. double
d. struct person
3) WHich *two* of the following statements are true?
a. the number of real
numbers is infinite
b. we can represent all real number using a finite number of
bits
c. it is possible to create a computer and operating system with
infinite memory
d. the memory of any actual computer is limited to a finite number
of bits
4)
The difference between a procedure and a function is:
a. Functions must
return values, procedures don't have to
b. Procedures are subprograms, functions aren't
c. Functions have side effects, procedures don't
d. None of the above
5) Consider this code:
double x;
void squarea(y){
x = y * y;
}
double squareb(y){
return y * y;
}
Which subprogram(s) has/have a side effect?
a. squarea()
b. squareb()
1) Whether names are case sensitive 2) either a pointer to a struct person or a void pointer 3) the number of real numbers is infinite it is possible to create a computer and operating system with infinite memory 4) Functions must return values, procedures don't have to 5) squarea()
1) A design issue for names is: a. Whether or not names should be in English...
Part 1: Implement a singly linked list -------------------------------------- (a) Your job is to implement a generic singly linked list that can hold any data type. The interface has been specified and provided to you in a header file called mylist.h. So your job is to write mylist.c that implements each function whose prototype is included in mylist.h. Specifically, you are asked to write the following functions: struct Node *addFront(struct List *list, void *data) void traverseList(struct List *list, void (*f)(void *))...
Please do it like someone wouldve done it as a beginer programer. Dont use pointer unless it asking for. /* Write a program designed to get ages and heights from the user, then find the average age, average height, and average age/height ratio. */ #include <stdlib.h> #include <stdio.h> #define MAXNUM 50 typedef struct person { int age; double height; } Person; int getData(Person people[], int max) /* Get the data from the user and put it in an array of...
Hi this is C++, I'm really struggle with it please help me.... ************************ Here is the original high score program,: Write a program that records high-score data for a fictitious game. The program will ask the user to enter five names, and five scores. It will store the data in memory, and print it back out sorted by score. The output from your program should look exactly like this: Enter the name for score #1: Suzy Enter the score for...
Hello I need help with this program. Should programmed in C!
Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...
C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...
linked list operation
/***************************************************************************************
This function creates a new node with the information give as a parameter and looks
for the right place to insert it in order to keep the list organized
****************************************************************************************/
void insertNode(string first_name, string last_name, string phoneNumber)
{
ContactNode *newNode;
ContactNode *nodePtr;
ContactNode *previousNode = nullptr;
newNode = new ContactNode;
/***** assign new contact info to the new node here *****/
if (!head) // head points to nullptr meaning list is empty
{
head = newNode;...
Need this in C
The starter code is long, if you know how to do it in other way
please do.
Do the best you can please.
Here's
the starter code:
//
-----------------------------------------------------------------------
// monsterdb.c
//
-----------------------------------------------------------------------
#include
#include
#include
//
-----------------------------------------------------------------------
// Some defines
#define NAME_MAX 64
#define BUFFER_MAX 256
//
-----------------------------------------------------------------------
// Structs
typedef struct
{
char name[NAME_MAX];
int hp;
int attackPower;
int armor;
} Character;
typedef struct
{
int size;
Character *list;
} CharacterContainer;
//
-----------------------------------------------------------------------
//...
// CSE240 Spring 2019 HW 7 & 8 // Write your name here // Write the compiler used: Visual studio or gcc // READ BEFORE YOU START: // You are given a partially completed program that creates a linked list of patient information. // The global linked list 'list' is a list of patients with each node being struct 'patientList'. // 'patientList' consists of struct 'patient' which has: patient name, room number, and a linked list of 'doctors'. // The...
COSC 112 Test #3 Spring 2019 20. It is not necessary to specify the parameter name in the parameter list of a function prototype even 21. Which of following is not a situation when reference parameters are useful? though there is a default parameter. (True/False) a. When you don't want to have side effects b. When you need to change the actual parameter c. When you need to return more than one value d. When you want to save memory...
Using C programming language
Question 1 a) through m)
Exercise #1: Write a C program that contains the following steps (make sure all variables are int). Read carefully each step as they are not only programming steps but also learning topics that explain how functions in C really work. a. Ask the user for a number between 10 and 99. Write an input validation loop to make sure it is within the prescribed range and ask again if not. b....