A)
Purpose of the given code:
The purpose of the given code is to declare a structure with a tag.
Syntax Error:
If a
B)
Purpose of the given code:
The purpose of the given code is to declare a structure with a tag which contains some variables.
Syntax Error:
If a program does not follow a certain protocol is called as syntax error; because the computer programs strictly follows the syntax rules, if the code fails to prove its language syntax format then the compiler will throw an error.
Want to see the full answer?
Check out a sample textbook solutionChapter 7 Solutions
Starting Out with C++: Early Objects (9th Edition)
- Void functions do not return any value when they are called.arrow_forward#include<iostream>#include<string.h>using namespace std; struct student{ int number; string name; int age; string city;}s[10]; struct module{ int number; string name; string code; int credit;}m[10]; struct assessment{ int number; int marks1; int marks2;}a[10]; int index1 =0, index2=0, index3=0; void StudentRegistration(){ if(index1==10) { cout<<"No more data can be added"<<endl; return; } string temp; cout<<"Enter personal data"<<endl; cout<<"Enter Student Number"<<endl; cin>>s[index1].number; cout<<"Enter Student Name"<<endl; getline(cin, temp); getline(cin,s[index1].name); cout<<"Enter Age"<<endl; cin>>s[index1].age; cout<<"Enter city"<<endl; getline(cin,temp); getline(cin,s[index1].city); index1++;} void ModuleEnrolment(int id){ if(index2==10) { cout<<"No more data can be…arrow_forwardstruct date{ int day; int month; int year; }; Write a function named void increaseDay(struct date *d) that increases the value of a variable of struct date type with integer year, month, and day members by one day. Write a function named void decreaseDay(struct date *d) that decreases the value of a variable of struct date type with integer year, month, and day members by one day. Write a C program that reads from the user a date in d/m/y format and the amount of increase or decrease as an integer. Display the new date in d/m/y format. You may call related functions as many as given increase or decrease value. Note 1: You do not need to consider leap years. Use always 28 days for month February. Note 2: Do not modify the function prototypes. Sample Input1: Sample Output1: 12/8/1990 -5 7/8/1990 Sample Input2: Sample Output2: 26/2/2005 5 3/3/2005 Sample Input3: Sample Output3: 29/12/1998 7 5/1/1999…arrow_forwardIn C++ struct applianceType { string supplier; string modelNo; double cost; }; applianceType myNewAppliance; applianceType applianceList[25]; Write the C++ statements that correctly initialize the cost of each appliance in applianceList to 0.arrow_forwardT/F A constructor must always return an intarrow_forwardIn C++ struct gameType { string title; int numPlayers; bool online; }; gameType Awesome[50]; Write the C++ Write the C++ statements that correctly initialize the online value of each game in Awesome to 1.arrow_forwardstruct 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; }; Using C language. 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); - reads a single name. void printName(payrecord payroll[], int i); - prints a single name. void…arrow_forward#include <iostream>#include <string>#include <iomanip>using namespace std;// structurestruct Hat{string brand;string color;float price;};// Customer structurestruct Customer{string fullName ;int age ;Hat hat; // Hat structure (nested in Customer)};int main(){// declare 5 variables of CustomerCustomer customer_1,customer_2,customer_3,customer_4,customer_5;cout<<"Welcome to Hats For U!\n";cout<<"Customer 1\n";cout<<"Enter customer's Full Name: ";getline(cin,customer_1.fullName);cout<<"Enter customer's age: ";cin>>customer_1.age;cout<<"Enter the brand of hat: ";cin>>customer_1.hat.brand;cout<<"Enter the hat color: ";cin>>customer_1.hat.color;cout<<"Enter the hat price(RM): ";cin>>customer_1.hat.price; cout<<"Hat 2\n";cout<<"Enter customer's Full Name: ";getline(cin,customer_2.fullName);getline(cin,customer_2.fullName);cout<<"Enter customer's age:…arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr