The following program compiles but does not run correctly. Fix it. Hint: you may need to use a different function. cstrings.cpp 1 #include #include using namespace std; 2 3 4 int main() { const int MAX = char cstr[MAX]; const char * src = "Artichoke"; 6. 7 10; 8 9 10 strcpy(cstr, src); cout <« "cstr->" « cstr « endl; } 11 12
Q: C++ Given Code #include #include #include using namespace std; // The puzzle will always have…
A: // CPP program for solving cryptographic puzzles#include <bits/stdc++.h>using namespace std;…
Q: below is the code I need help with answering the questions in the image//
A: Here is the explanation about the scope of the variables:
Q: Write a program that reads in the first and last name of a person and formats the full name as the…
A: The Answer is in below Steps:-
Q: 1 #include 2 #include 3 using namespace std; 4 int main() { const int MAX = 10; char cstr[MAX];…
A: Code :- If you give more memory allocation to the character array cstr[35] it gives no error.…
Q: /* Using JAVASCRIPT write a function that parses through the below object and displays all of their…
A: I have done the code using Javascript
Q: Given float MyValues[ ]=(-0.4, 3.14, 99.9, 119.99); and int index=2; what will be displayed by the…
A: First we are defining array of float values with 4 items in array, and integer index variable with…
Q: C++ Format Please Write a function called SortByUpper, that takes a vector of strings and changes…
A: Explanation: The vector is sorted by comparing second element of every row. We are assuming that the…
Q: Write a program continuously asks the user to enter a sentence until they type "-999".
A: The following is the required python program #the function definition for uppercasedef…
Q: #include #include #include #include using namespace std; class Movie { private:…
A: According to the information given:- We have to write a program on the basis of instruction mention.
Q: #include #include #include using namespace std; class Movie { private: string title =…
A: It is defined as a powerful general-purpose programming language. It can be used to develop…
Q: Create a JavaScript Arrow fiunction that meets the following requirenments: • Authored using arrow…
A: I have provided HTML CODE ( having internal JAVASCRIPT ) along with CODE SCREENSHOT and…
Q: C++ This is the given code: #include #include #include using namespace std; // The puzzle…
A: #include <iostream> #include <fstream> #include <vector> #include <ctime>…
Q: #include #include #include #include #include class CAT{ public: float weight() const{return…
A: Algorithm for CAT Class Constructor1. Start2. Define the CAT class with private member variables:…
Q: #include struct dna { int number; char text; char stringvalue[30]; }; int main() {…
A: NOTE: - As asked the comments are being added on each line of the program. Any modification other…
Q: 17. Given the following C code, what is the value of scores[5]? int scores[] =…
A: The objective of the question is to determine the value of the 6th element in the array 'scores'. In…
Q: In this lab, you use what you have learned about searching an array to find an exact match to…
A: #include <iostream>#include <string>using namespace std; int main() { string…
Q: C++ Given code #include #include #include using namespace std; // The puzzle will always have…
A: CODE: // CPP program for solving cryptographic puzzles#include <bits/stdc++.h>using namespace…
Q: c programming 2dim array string <stdio.h><string.h> please fix my codes…
A: 2d-char array named words is declared to take input from the user. the do-while loop is used to take…
Q: Code in c language, please. Thank you in advance. Assign listOfPizzas's first element's…
A: Assign listOfPizzas's first element's numberOfCalories with the value in listOfPizzas's second…
Q: #include #include #include using namespace std; class BalancedTernary { protected: // Store the…
A: Answer: C++ Source Code: #include <iostream>#include <string>#include <climits>…
Q: #include using namespace std; int binarySearch(int[], int, int, int); int main () { int…
A: #include<iostream>using namespace std;int main(){ int arr[10] = {16, 19, 20, 23, 45, 56,…
Q: Lab 6 Use the lab5.cpp as a started file. Modify the program is it generates 1000 points with a…
A: The Algorithm of the code is as follows:- 1. Set up an array of structs to hold 1000 points2. Set up…
Q: this code does mot run on visual studio what is the soloution ?
A: Given source code is successfully executed and we provide the output screenshot also.
Q: #include #include #include #include using namespace std; class Movie { private: string…
A: We will create a structure named StudentRec and then we will add students records accordingly and…
Q: Q5: What would happen if you passed in the address of the initialized global variable into…
A: we can access global variable if there is a local variable through EXTERN and scope resolution . The…
Q: C++ What is the output? int columns; int rows; for (rows = 0; rows < 2; ++rows) { for…
A: Given: C++ What is the output? int columns;int rows;for (rows = 0; rows < 2; ++rows) {…
Q: #include #include #include #define EMPS_SIZE 20 #define SSN_SIZE 9 #define MAX_EMPS 19…
A: Define the Employee struct to hold information about each employee, including name, salary, year of…
Q: #include #include #include using namespace std; class BalancedTernary { protected: //…
A: Output of the given code: In the main function, the code asks for input of a,b,c and calls…
Q: #include #include #include #include #include class CAT{ public: float weight() const{return…
A: A public member function called set_range(unsigned int power) in the CAT class is intended to alter…
Q: Q1: How many total calls to malloc are made during createEmployee (including readEmployee and…
A: Hi there, please find your solution below, I hope you would find my solution useful and helpful,…
Q: // MichiganCities.cpp - This program prints a message for invalid cities in Michigan. // Input:…
A: You need to check with each and every element in the array of strings and if it equals the input…
Q: /below is the code I need help with answering the questions in the image// #include…
A: Q3: Many people put the SSN in a char[9] field (1 kind of encouraged it). Is that big enough to hold…
Q: T/F The << operator is overloaded to input data items of fundamental types, strings and…
A: Answer: Explanation: cin stream is connected to standard input device like keyboard not display.
Q: #include using namespace std; int binarySearch(int[], int, int, int); int main () { int arr[10] =…
A: Include the header files Declare the Global variable count and initialize it to 0 Declare the binary…
Q: /*Line 1:*/ doublevalues[6] = {10, 20, 30, 40, 50, 60}; /*Line 2:*/ double* yalptr= values; /*Line…
A: NOTE: - There is error on line 1 the way of declaring and initializing an array is wrong.…
Q: Q5: What would happen if you passed in the address of the initialized global variable into…
A: Here we have given the answer differentiating global and local variables in c. and how they can be…
Q: Q2: If the employee's name is Joe Smith, how much total memory is allocated for the structure and…
A: As per the guidelines we have given answer for the first three question that are Q2, Q3 and Q4. you…
Q: #include #include #include #include using namespace std::chrono; using namespace std; void…
A: Below I am attaching a code for all file: 1 VectorAdd.cpp 2 ParallelVectorAdd.cpp
Q: #include using namespace std; struct item { int id; float price; } s[50]; int size=0;…
A: Algorithm: for (initialExpression; testExpression; updateExpression){ // body of the…
Q: Create pseudocode for the following #include <iostream> #include <string>…
A: Program Instruction:Pseudo is just an implementation of the algorithm where everyone can easily able…
Q: palindromes Write a function palindromes that accepts a sentence as an argument. The function then…
A: Let's go through the code step by step: 1. Importing Required Module: The code starts with importing…
Q: //below is the code I need help with answering the questions in the image// #include…
A: #include <stdio.h> #include <stdlib.h> typedef struct{ char name[30]; int id;…
Q: Q5: What would happen if you passed in the address of the initialized global variable into…
A: In the current code there is not initialized global employee variable But if there was a global…
Q: #include #include struct info{ char names[100]; int age; float wage; }; int main(int argc, char*…
A: C programming is a general-purpose, procedural, imperative computer programming language developed…
Q: #include using namespace std; void scanPrice (string [], double []); // Do not modify the code…
A: In this question we asked to write two function scanPrice and printReceipt in C++ Algorithm: 1) Pass…
Q: please use DEQUE #include #include #include using namespace std; const int AIRPORT_COUNT =…
A: Answer: #include<iostream> #include<stack> using namespace std; const int…
Q: #include using namespace std; struct Employee { string firstName; string lastName;…
A: This program reads a text file of employee records into a linked list of Employee structs, then…
Q: csv file "/dsa/data/all_datasets/texas.csv" Task 6: Write a function "county_locator" that allows…
A: According to the question , we have toWrite a function "county_locator" that allows a user to enter…
Q: nclude nclude nclude nclude t i; ar n=1,username[16], password[30],ch; id welcome()…
A: Algorithm welcome(): Clear screen Display WELCOME TO MY SITE main(): Start Initialize n to 1…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- #include <bits/stdc++.h> using namespace std; struct Employee { string firstName; string lastName; int numOfHours; float hourlyRate; char major[2]; float amount; Employee* next; }; void printRecord(Employee* e) { cout << left << setw(10) << e->lastName << setw(10) << e->firstName << setw(12) << e->numOfHours << setw(12) << e->hourlyRate << setw(10) << e->amount << setw(9) << e->major[0]<< setw(7) << e->major[1]<<endl; } void appendNode(Employee*& head, Employee* newNode) { if (head == nullptr) { head = newNode; } else { Employee* current = head; while (current->next != nullptr) { current = current->next; } current->next = newNode; } } void displayLinkedList(Employee* head) { Employee* current = head; if(current!=nullptr){ cout…# dates and times with lubridateinstall.packages("nycflights13") library(tidyverse)library(lubridate)library(nycflights13) Qustion: Create a function called date_quarter that accepts any vector of dates as its input and then returns the corresponding quarter for each date Examples: “2019-01-01” should return “Q1” “2011-05-23” should return “Q2” “1978-09-30” should return “Q3” Etc. Use the flight's data set from the nycflights13 package to test your function by creating a new column called quarter using mutate()#include <iostream> #include <iomanip> #include <string> #include <vector> using namespace std; class Movie { private: string title = ""; int year = 0; public: void set_title(string title_param); string get_title() const; // "const" safeguards class variable changes within function string get_title_upper() const; void set_year(int year_param); int get_year() const; }; // NOTICE: Class declaration ends with semicolon! void Movie::set_title(string title_param) { title = title_param; } string Movie::get_title() const { return title; } string Movie::get_title_upper() const { string title_upper; for (char c : title) { title_upper.push_back(toupper(c)); } return title_upper; } void Movie::set_year(int year_param) { year = year_param; } int Movie::get_year() const { return year; } int main() { cout << "The Movie List program\n\n"…
- #include <iostream> #include <iomanip> #include <string> #include <vector> using namespace std; class Movie { private: string title = ""; int year = 0; public: void set_title(string title_param); string get_title() const; // "const" safeguards class variable changes within function string get_title_upper() const; void set_year(int year_param); int get_year() const; }; // NOTICE: Class declaration ends with semicolon! void Movie::set_title(string title_param) { title = title_param; } string Movie::get_title() const { return title; } string Movie::get_title_upper() const { string title_upper; for (char c : title) { title_upper.push_back(toupper(c)); } return title_upper; } void Movie::set_year(int year_param) { year = year_param; } int Movie::get_year() const { return year; } int main() { cout << "The Movie List program\n\n"…C++ help with this fixing code .cpp file #include<iostream>#include<string>#include<vector>#include"Food.h"using namespace std; class Nutrition{ private: string name; double Calories double Fat double Sugars double Protein double Sodium Nutrition(string n, double c, double f, double s, double p, double S): name(n), Calories(c), Fat(f),Sugars(s), Protein(p),Sodium(S){} food[Calories]= food[Fat]=food[Sugars]=food[Protein]=food[Sodium]=0; name = "";} Nutrition(string type, double calories, double fat, double sugar,double protein, double sodium){ food[Calories]= calories; food[Fat]=fat; food[Sugars]= sugar; food[Protein]=protein; food[Sodium]=sodium; name= type; } void setName(string type){ name = type; } void setCalories(double calories){ food [Calories]= calories; } void setFat(double fat){ food [Fat]= fat; } void setSugars(double sugar){ food [Sugars]= sugar; } void setProtein(double protein){ food [Protein]= protein; } void…#include <iostream> #include <string> #include<iomanip> using namespace std; int main() { int monthlyUsage[12]; double consumption[12]; double discount[12]; double tax[12]; double bill[12]; string fullMonthName[12] = { "January","February","March","April","May","June","July","August","September","October","November","December" }; string month[12] = { "Jan","Feb","March","April","May","June","July","Aug","Sep","Oct","Nov","Dec"}; for (int i = 0; i < 12; i++) { cout << "please input monthly usage in kWh for " << fullMonthName[i] << ": " <<endl; cin >> monthlyUsage[i]; // Get user input and put it inside array monthlyUsage // TO DO CALCULATION FOR THE CONSUMPTION if (monthlyUsage[i] > 0 && monthlyUsage[i] < 101) { consumption[i] = (17.5/100) * monthlyUsage[i]; } else if (monthlyUsage[i] > 100 && monthlyUsage[i] < 201) { consumption[i] = 17.5 + ((monthlyUsage[i] - 100) * (18.5 / 100)); } else if (monthlyUsage[i]…
- #include<iostream>using namespace std;const int rows=10;const int columns=10;int computer_board1[rows][columns];int computer_board2[rows][columns];int player_board[rows][columns];int x,y;void setboard(){for(int i=0;i<rows;i++){for(int j=0;j<columns;j++){computer_board1[i][j]=0;player_board[i][j]=0;}}}void display_computer_board1(){cout<<"Computer's Board"<<endl;cout<<" 0 1 2 3 4 5 6 7 8 9 "<<endl;for(int i=0;i<rows;i++){for(int j=0;j<columns;j++){if(j==0){cout<<i<<" ";}cout<<computer_board1[i][j]<<" "; }cout<<endl;}cout<<endl;}void display_player_board(){cout<<"Your Board"<<endl;cout<<" 0 1 2 3 4 5 6 7 8 9 "<<endl;for(int i=0;i<rows;i++){for(int j=0;j<columns;j++){if(j==0){cout<<i<<" ";}cout<<player_board[i][j]<<" "; } cout<<endl;} }void place_player_ships(){for(int i=1;i<=15;i++){cout<<"Horizontal…//below is the code I need help with answering the questions in the image// #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for (int i = 0; i < 9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to print the employee data to console void display(struct employees *e) { printf("%s",…//below is the code I need help with answering the questions in the image// #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for (int i = 0; i < 9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to print the employee data to console void display(struct employees *e) { printf("%s",…
- make structure chart for this code plz #include <stdio.h> #include <term.h> char box[10]={'0','1','2','3','4','5','6','7','8','9'}; void create_board(); void make_board(int, char); int check_win(); int main() { int choice,player=1,i; char mark; do{ create_board(); player= (player % 2) ? 1: 2; printf("Player %d, enter a number: ",player); scanf("%d",&choice); mark = (player==1) ? 'X' : 'O'; make_board(choice,mark); i=check_win(); player++; }while(i == -1); create_board(); if(i==1) printf("Player %d you have won the game",--player); else printf("< Draw >"); return 0; } void create_board() { clear_screen; printf("\n\n\tTic Tac Toe\n\n"); printf("Player 1 (X) -- Player 2 (O)\n\n"); printf(" | | \n"); printf(" %c | %c | %c \n",box[1],box[2],box[3]);…C++ 2D ARRAY, Continue this codes and change the array to seat[6][6]. Include a loop that asks the user if he wants to try again or no. If the user enters the reserved seat again then display "this seat is taken already". Upon trying again, the reserved seat displayed as (X) must be displayed. My Code: #include <iostream> using namespace std; int main() { cout << "Bus Seats:\n"; cout << "* A B C D\n" << "1 * * * *\n" << "2 * * * *\n" << "3 * * * *\n" << "4 * * * *\n"; char seat[5][5]; int row, column; char col; cout << "Enter the row of your selected seat: "; cin >> row; cout << "Enter the column of your selected seat: "; cin >> col; for(int i=0; i<5; i++){ for(int j=0; j<5; j++){ if(i==0){ switch (j) { case 0: seat[i][j]='*'; break; case 1: seat[i][j]='A'; break; case 2: seat[i][j]='B'; break; case 3: seat[i][j]='C'; break; case 4: seat[i][j]='D'; break; } } else if (j==0) { switch(i) { case 1: seat[i][j]='1';…//below is the code I need help with answering the questions in the image// #include <stdio.h> #include <stdlib.h> struct employees { char name[20]; int ssn[9]; int yearBorn, salary; }; // function to read the employee data from the user void readEmployee(struct employees *emp) { printf("Enter name: "); gets(emp->name); printf("Enter ssn: "); for (int i = 0; i < 9; i++) scanf("%d", &emp->ssn[i]); printf("Enter birth year: "); scanf("%d", &emp->yearBorn); printf("Enter salary: "); scanf("%d", &emp->salary); } // function to create a pointer of employee type struct employees *createEmployee() { // creating the pointer struct employees *emp = malloc(sizeof(struct employees)); // function to read the data readEmployee(emp); // returning the data return emp; } // function to print the employee data to console void display(struct employees *e) { printf("%s",…