C PROGRAMMING Given code: struct record { char name[10]; int age; }; struct record myfriend = {“Dhang”, 24}; struct record *ptrtomyfriend = &myfriend; ANSWER THE FOLLOWING: a. Write a C statement showing how to display the value of first member being pointed by ptrtomyfriend, using ptrtomyfriend. b. Write a C statement showing how to display the value of the second member being pointed by ptrtomyfriend. c. Write a C statement showing how to store new value of the members being pointed by ptrtomyfriend.
Q: Language: C++ Subject: OOP Task:You have to write a program to store information of university…
A: Introduction to class When you define a class, you define a blueprint for a data type. This doesn't…
Q: Scope resolution operator is used while declaring the functions in the class interface. A class must…
A: Scope Resolution operator public or private is optional while declaring the functions in the class…
Q: typedef char string[50]; struct a Tag { int a; float b; double C[ 10 ]; string s; }; // 1. indicate…
A: Here is the complete program to perform all the actions which were asked. Pointers to the structure…
Q: Declare a struct called "studentInfo" containing the following three variables: student ID, name,…
A: Structure definition in c++: #include<iostream> using namespace std; struct studentInfo{ int…
Q: C++] Write a function that creates a dynamic sequential structure. The structure contains the…
A: / C++ program to find longest // contiguous subsequence #include <bits/stdc++.h> using…
Q: File and Share Access part of the assignment showed you that share pe ly. Describe: issions from a…
A: Given:
Q: Write a structure called student that has the following fields. Each student must have first name,…
A: Program: #include<stdio.h> #include <string.h> /* Defining structure of name student.…
Q: TIME CLASS (Language: C++) - Write a time class named timeClass - Write code to demonstrate that…
A: Program: Filename: Main.java import java.util.*; import java.lang.*; import java.io.*; class…
Q: Assume the pointer you defined in question 10.18 points to a valid Rectangle structure. Write the…
A: Given:- struct Rectangle { int length; int width; };
Q: SUBJECT: PROGRAMMING FUNDAMENTELS LAB IT provides best solutions for manual work that makes life…
A: Given: SUBJECT: PROGRAMMING FUNDAMENTELS LAB IT provides best solutions for manual work that makes…
Q: The definition of struct of UPSI students is shown below. struct student_upsi{ char nama[40];…
A: A structure is a user-defined data type in C/C++. A structure creates a data type that can be used…
Q: The listed at the be Mark the following statements as true or false. All members of a struct must be…
A: a) False, as it can be of the same type also, not necessary to be different types. b) True, struct…
Q: [1). Given the following Structure that represents a Student Struct: ruct Student{ char name[20];…
A: It is defined as a direct descendant of C programming language with additional features such as type…
Q: Student quizzes and grade application Write a C++ class called Student that should contain the…
A: Student.h #include <iostream>using namespace std; //Student classclass Student{ private:…
Q: IN C++ NOTE: do not use classes or pointers for Lab 6 - Part B. You are only to use struct data to…
A: ANSWER:-
Q: Define a struct computerType to store the following details about a computer: manufacturer (string),…
A: #include <iostream>#include<string.h>using namespace std;struct computerType { string…
Q: Member variables: • int day; • int month; • int year; Member functions: • setDate: Takes three…
A: Actually, program is an executable software that runs on a computer.
Q: C PROGRAMMING 1. A structure cannot have members with the same name. (TRUE OR FALSE) 2. Create…
A: Given:- C PROGRAMMING 1. A structure cannot have members with the same name. (TRUE OR FALSE) 2.…
Q: I/ Progran name: Labza I Description: rite the program description here.> 1 what's on your mind…
A: code : #include<bits/stdc++.h> using namespace std; struct Sale{ string itemname; int…
Q: C++ Movie Data Create a program that uses a structure named MovieData to store the following…
A: Introduction of the Program: The C++ program uses structure data type to store the data of the Movie…
Q: C++ Programing ATTRIBUTES NOTE: The important method has been given to you. userld:int //generates…
A: A class is the basic unit of object oriented design. An instance of a class is called an object. A…
Q: Language=C++ Create an employee class. The member data should comprise an int for storing the…
A: 1. create a class employee.2. use function to get the data.3. take the input.4. display the result…
Q: OOP Create a struct Rectangle where a rectangle is defined by Length & Width. Each Rectangle has an…
A: as per Bartleby guidelines we are supposed to answer?️ only one question. Kindly repost other…
Q: Suppose you own a hospital, and you have 30 doctors appointed in the hospital. You need to maintain…
A: The username and password is set as: username=user_123 password=1234 The program is written in C++…
Q: 1.8 When declaring a new variable out of an existing enumerated data type, you use the keyword: а.…
A: When declaring a new variable out of an existing enumerated data type, the keyword typedef is used.…
Q: struct namerec{ char last[15]; char first[15]; char middle[15]; }; struct payrecord{ int id; struct…
A: #include<stdio.h>#include<stdlib.h> struct namerec{ char last[15]; char first[15];…
Q: C++ Create a class Rectangle. The class has attributes length and width, each of which defaults to…
A: The , code has given below:
Q: 4. The using statement simplifies the accessing of namespace members. True False
A: when accessing a namespace member without the using statement the namespace name and the scope…
Q: Requirements: You are working for a meteorologist to maintain a list of temperatures and some…
A: Program code: #include <iostream> //for cout and cin #include <vector> //for vectors…
Q: Create a class Employee with following Data Members with private access modifier. Employee Name.…
A: Check before setting values for age and salary If age is not greater than 18, set it to some default…
Q: Programming language : c++ Question : Make a class Student with attributes StudentName,…
A: Include the Header files Create a class name student with data members StudentName, Enrollment,…
Q: Topic: Struct Write a C++ program that records and displays league standings for a baseball league…
A: Code: #include <iostream>#include <cstring>using namespace std;//define struct to…
Q: Write in C++ Language. (Mini Library): Create a structure containing book information Data…
A: #include<iostream> #include<vector> #include<map> using namespace std; typedef…
Q: Q1: Write a C++ class called 'Circle' with private data members: name(string type) and Radius (float…
A: I have given an answer in step 2.
Q: C++ HELP! NO STRUCTURES USED! Hello I've tried to ask this question before, but the answer I…
A: The C++ code is given below:
Q: Topics: Functions, Dictionary, I/O Problem description: Write a python application to simulate an…
A: Given: please make sure the code follows sample output highlighted in light blue
Q: struct namerec{ char last[15]; }; char first[15]; char middle[15]; struct payrecord{ int id; struct…
A: C program to report the total gross pay and tax with held.
Q: Create a class Class1 with a string data member ‘paragraph’. Provide a constructor and…
A: The program is written with two classes 1 and 2. Sample output:
Q: Language : C++ Create a class named myString,which consists of one string data member and three…
A: EXPLANATION: - The myString class comprises one private member variable text of type string. The…
Q: C++ simple friend function. Create a C++ class called cube that calculates the volume of a cube.…
A: #include <iostream>#include <math.h>using namespace std; class cube{ private:…
Q: Write program in C. Create a structure called Studentsthat holds information likeRegistration code,…
A: for (int i = 0; i < 5; i++) { printf("Enter registration code for student %d: ",i+1);…
Q: Write the C++ definition of a data structure (complexNumber). It contains two float data members…
A: real() – It returns the real part of the complex number. imag() – It returns the imaginary part of…
Q: Module/Week 6 Assignment (User-defined: Simple Data Types, String Types) You are working for a…
A: C++ Source Code//include the required header files#include<iostream>#include…
Q: In C# Define 4 methods with the names of addition, subtraction, multiplication and division. In…
A: Ans:- Code:- using System; public class Calculator { public static void Main() {…
Q: Define a struct type that represents an exercise plan. The struct should store the following data:…
A: Part A structure name= exercise_plan Definition of structure: struct exercise_plan { char…
Q: Structures, like any other type, may have their own set of pointers. Structures that nest Returning…
A: The add of the whole structure is held by the pointer to structure. It's used to construct…
Q: typedef char string[50]; struct a Tag { int a; float b; double C[ 10 ]; string s; }; // 1. indicate…
A: Structure in C programming language is an abstract data type that lets create a user-defined data…
Q: C+ Programming Assignment 1 Loan Payment Calculator The purpose of this assignment is to get you…
A: Step 1:- Given:- Credit Score Categories Excellent 720-850 Good 690-719 Fair 630-689 Bad 300-629…
Q: Question: Create a structure called employee that contains two members: an employee number (type…
A: In the c++ program, include the necessary libraries and then create a structure named 'employee' in…
Q: struct is used to store the data that have a different data type. In C++, the definition of struct…
A: Use an array to store all 10 students information
C
Given code:
struct record
{
char name[10];
int age;
};
struct record myfriend = {“Dhang”, 24};
struct record *ptrtomyfriend = &myfriend;
ANSWER THE FOLLOWING:
a. Write a C statement showing how to display the value of first member being pointed by ptrtomyfriend, using ptrtomyfriend.
b. Write a C statement showing how to display the value of the second member being pointed by ptrtomyfriend.
c. Write a C statement showing how to store new value of the members being pointed by ptrtomyfriend.
Step by step
Solved in 5 steps with 1 images
- This need to be written in c++ Write a program that: Defines an enum named Classification. The enum Classification will have 2 data values: undergraduate, graduate. Defines an enum named Status. The enum Stutus will have 2 data values: parttime, fulltime. Defines an enum named Residency. The enum Residency will have 2 data values: resident, international. Defines a student name variable. Creates a Classification, Status, and Residency, credit hour, cost per credit hour, and tuition variable. Reads the value of the Classification, Status, and Residency, student name and credit hour variable from the user. If the student is a fulltime undergraduate resident student, tuition is credit hour times 345.00 If the student is a fulltime undergraduate international student, tuition is credit hour times 685.00 If the student is a fulltime graduate resident student, tuition is credit hour times 545.00 If the student is a fulltime graduate international student , tuition is credit hour times…Topic: Struct Write a C++ program that records and displays league standings for a baseball league uisng Struct. The program will ask the user to enter five team names, and five win amounts. It will store the data in memory, and print it back out sorted by wins from highest to lowest.struct namerec{ char last[15]; char first[15]; char middle[15]; }; struct payrecord{ int id; struct namerec name; float hours, rate; float regular, overtime; float gross, tax_withheld, net; }; Given the above declaration, let payroll data record be stored in a structure called payrecord. Also define a type called payrecord for the structure data type that houses a payroll data record: typedef struct payrecord payrecord; This program reads data, computes payroll and prints it. Each data record is a structure, and the payroll is an array of structures. Overtime hours are 150% of the rate. (Note: Maximum regular hours for the week is 40.) Tax is withheld 15% if weekly pay is below 500, 28% if pay is below 1000, and 33% otherwise. A summary report prints the total gross pay and tax withheld. The following are the function prototypes: void readName(payrecord payroll[], int i); -…
- // TYPEDEFS and MEMBER CONSTANTS for the sequence class:// typedef ____ value_type// sequence::value_type is the data type of the items in the sequence.// It may be any of the C++ built-in types (int, char, etc.), or a// class with a default constructor, an assignment operator, and a// copy constructor.//// typedef ____ size_type// sequence::size_type is the data type of any variable that keeps// track of how many items are in a sequence.//// static const size_type DEFAULT_CAPACITY = _____// sequence::DEFAULT_CAPACITY is the default initial capacity of a// sequence that is created by the default constructor.//// CONSTRUCTOR for the sequence class:// sequence(size_type initial_capacity = DEFAULT_CAPACITY)// Pre: initial_capacity > 0// Post: The sequence has been initialized as an empty sequence.// The insert/attach functions will work efficiently (without// allocating new memory) until this capacity is reached.// Note: If Pre is not…// TYPEDEFS and MEMBER CONSTANTS for the sequence class:// typedef ____ value_type// sequence::value_type is the data type of the items in the sequence.// It may be any of the C++ built-in types (int, char, etc.), or a// class with a default constructor, an assignment operator, and a// copy constructor.//// typedef ____ size_type// sequence::size_type is the data type of any variable that keeps// track of how many items are in a sequence.//// static const size_type DEFAULT_CAPACITY = _____// sequence::DEFAULT_CAPACITY is the default initial capacity of a// sequence that is created by the default constructor.//// CONSTRUCTOR for the sequence class:// sequence(size_type initial_capacity = DEFAULT_CAPACITY)// Pre: initial_capacity > 0// Post: The sequence has been initialized as an empty sequence.// The insert/attach functions will work efficiently (without// allocating new memory) until this capacity is reached.// Note: If Pre is not…Description You should include a program description at the top of the main program according to the template. You may simply use this sentence, "This program processes nutrition information with a class." Write A Class Declare a class/struct named NutritionData that contains these private fields foodName (string) servingSize (int) calFromCarb (double) calFromFat (double) calFromProtein (double) Use the data types in parentheses for the fields. Note that you need to use the proper C++ syntax for the fields. Each field should have a comment documenting what it is for. Place one comment above each field. Add the public default constructor. Read the textbook for the syntax of the default constructor. Write the body of the default constructor inline. The default constructor initializes the fields so that the food name is an empty string and all other fields are 0 for int and 0.0 for double. Add public mutator member functions to set the fields. One mutator member function for each…
- C++ simple friend function.Create a C++ class called cube that calculates the volume of a cube. Use appropriate accessors (getters) and mutators (setters), constructors, etc. Your program must also include a friend function that will sum the volume of two cube class instances.Output the individual volumes of each of the two cube classes and then the total volume from the friend function. Example of friend funtion #include <iostream> using namespace std; class Box { double width; public: friend void printWidth( Box box ); void setWidth( double wid );}; // Member function definitionvoid Box::setWidth( double wid ) { width = wid;} // Note: printWidth() is not a member function of any class.void printWidth( Box box ) { /* Because printWidth() is a friend of Box, it can directly access any member of this class */ cout << "Width of box : " << box.width <<endl;} // Main function for the programint main() { Box box; // set box width…name formatter on c# create an application that lets the user enter the following pieces of data: • the user’s first name • the user’s middle name • the user’s last name • the user’s preferred title (mr., mrs., ms., dr., etc.) assume the user has entered the following data: • first name: kelly • middle name: jane • last name: smith • title: ms. the application should have buttons that display the user’s name formatted in the following ways: ms. kelly jane smith kelly jane smith kelly smith smith, kelly jane, ms. smith, kelly jane smith, kellyC# Language(WinForm Application) In this exercise, you complete an application that determines whether a person qualifies for a loan. To qualify for the loan, the person must earn a salary of at least $40,000 and must have been employed at his or her current job for at least 2 years.
- C code Blocks Select all of the code segments that are the correct way to define a variable class as an array of 185 personal structures. struct personal { int id; // id numberchar name[80];}; Options: a .personal class[185]; b. struct personal class[185]; c. typedef struct personal classStruct;classStruct class[185]; d. typedef class[185];C++ PROGRAM STRING MANIPULATION Create a class Class1 with a string data member ‘paragraph’. Provide a constructor and getParagraph() method in the class. The constructor just assigns NULL to the data member. getParagraph() method must read a paragraph from user. The paragraph should contain at least 30 words. If there are less than 20 words, the program must ask user to enter paragraph again. Create another class Class2, and make it a friend of the class Class1. Provide a function getSubString(Class1 &obj1, int startIndex, int lastIndex) with return type string in the class Class2 which accepts an object of class Class1 (by reference) and two integers. The getSubString() function should return the substring starting from location startIndex and ending at location lastIndex. Class2 must also contain a store() function that stores the substring in a file. Print screenshot of substring stored in file as well.Please code using C++ and only using the header <iostream>. Any others will not be accepted. Attached is a hint as it must include the member functions of cout. Thank you!