Given the following piece of code int i - 10; char c= 'A'; double f = 25.5; int *iptr = &i; char *cptr = &c; You are expected to display the result of following statements in the given format.
Q: B) What is the value of speed when the following code snippet runs successfully? const int…
A: 1) Code snippet in Question B does below activities It defines MIN_SPEED 45 and MAX_SPEED as 65…
Q: 22. What will be the output of the given code? #include using namespace std; int main() { } int a;…
A: Output of the given code will be 14
Q: d. Given that an int variable s has been initialized, write a statement(s) that declares a new…
A: d) int s1=(9*(s-8))%4
Q: Write the output of the code given below?…
A: Answer: In the above given program the output will be null it will print nothing. It will print…
Q: void fun (int& x, double y = 2.8, double z=5.4, char c = 'h') if (isupper (c)) cout << x + y-z; else…
A: explanation: when fun call x=3, y=3.6, z=5.4, c=h ( y not equal to 2.8 because we pass y=3.6 if…
Q: 19 With the following declaration: int [,] points = {{300, 100, 200, 400, 600}, {550, 700, 900, 200,…
A: Required:
Q: What would be the value of i and j after the ?following code executed ;int i = 5 :++int j = i :cout…
A: Please find the answer below
Q: Given the following code and output: int a[] = {10, 20, 30, 40}; cout << a << endl; Example Output…
A: Please find the answer to the above question below:
Q: Q16/ Write a program that accepts a user-entered number and calculates the square root. Before…
A: Sample Response: //C++ program to calculate the square root of a user-entered number#include…
Q: What is the output of the following code? #include > using namespace std; int main() int arr[] =(4,…
A: Given options: 7 5 6 4 Given code: #include<iostream>using namespace std; int main(){…
Q: #include int main() int i=7; do for(int j=7;j4);
A: Here, Code is given to trace.
Q: What would be the value of i and j after the ?following code executed ;int i = 5 ;++int j = i
A: In pre increment, the value gets updated first and then changed in the location whereas in post…
Q: What is the output of the following code: #include using namespace std; int main(){ int i 2; int j…
A: Here first we create a variable i that hold 2 int i=2; int j=++i; -> this will first increase…
Q: ? What is the output of the following code #include using namespace std ; int main() { int i= 0, x =…
A: There is one C++ Program given. We have to find the right output of the program from the given four…
Q: Given the following: int s = 50; int t = 25; s= ++t - 5; s+t; t = s + 3; a. What is the value of s…
A: a) The value of s will be 22 SCREENSHOT OF OUTPUT:-
Q: # include main () {int i, j; int A[4][4]; for (i=0; i<=3; i++) for (j=0; j<=3; j++) {- for (i=0;…
A: Given: The statements to generate 4x4 A array
Q: Fill in the blanks above C++ code. !!! DO NOT USE ANY WHITESPACE ! #include include #include…
A: Fill ups: #include <cstdlib> using namespace std; int myArray [10]; for(int i = 0; i < 10;…
Q: What is the output of the following code: #include using namespace std; int main(){ const int LUCKY…
A: Please find the answer below :
Q: 4. What is the output of the following code? int test func (int value) value = 10*value; cout <<…
A: The answer is...
Q: ?What is the output of the following code #include using namespace std; int main() { int a[5] int T…
A: Below is the executable code that i run on the compiler :- #include<iostream>using…
Q: What would be the value of i and j after the ?following code executed ;int i = 5 ;++int j = i ;cout…
A: d) 75 Step by Step Execution : i = 5 j = i++ = 5 ( Value is first used and then incremented , j is…
Q: Show the printout of the following code: int a = 6; int b = a++; cout << a << end1l;…
A: Given: Show the printout of the following code: int a = 6; int b = a++; cout << a <<…
Q: The value of b in below code ;int a=3,b :2=( a==1? a:b) ;cout <<b
A: Given a=3 Given expression a==1?a:b=2; This expression includes ternary operator. If a==1, left hand…
Q: void func(int&, int& b, float& ) { cout > a; // enter e cout > b; // enter 1
A: Please find the answer below :
Q: 9 - With the following declaration: int [.] points = {{300, 100, 200, 400, 600}, {550, 700, 900,…
A: Required:
Q: #include int main() { float a =3e-1,b=2e-2; printf("a=%f b=%f",a,b); return 0; } note : what is e…
A: e work as scientific notation for example. Significand Exponent Scientic notation float/fixed…
Q: Given the following code: long int data[] - {5, 7, 9, 1}; long int ptr - nullptr; Write a statement…
A: 2
Q: include doublevalue (int z) { z*=2; --z; return z;} int main( ) {int a, b; a=16; b=23;…
A: In the above program, aa,bb,f are not declared doublevalue function is returning int value, but…
Q: in this program. a, int b, int *c, int *d, int *resu a, int *b, int *c, int *d, int *resu int *res
A: I have written the code below:
Q: What would be the output of the following code? #include using namespace std; int main(){ int b =…
A: Switch case: Switch statement is operated based on the expression of the switch. Switch statement…
Q: 22. What will be the output of the given code? #include using namespace std; int main() { } int a;…
A: Find the output of the given C++ program. About the given program: In the given program, two integer…
Q: Analyze the following code and then answer the following questions: #include using namespace std;…
A: The above question that is code for intialization of variable is answered in step 2 and the line…
Q: The following declaration, program, and program segment has errors. Locate as many as you can.…
A: One may want to set a default value for the property member, and therefore when not started would…
Q: The value of a in below code is } ;int a=3 ;float b=3.0 ;a+= (a==b)? b:-b ;cout << a {
A: Here, one C++ code snippet is given. Find the output of the code: int a=3; float b=3.0;…
Q: #include int main() { int i=7; do { for(int j=7;j4); return 0;
A: Here, Code is given to tracing.
Q: Will the following code display the larger of the two values? Answer the question and explain your…
A: Given program: #include <iostream>using namespace std; void find_larger(int v1,int v2, int…
Q: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send the…
A: Given: Look at the following code. int x = 7; int *ptr = &x;What will be displayed if you send…
Q: Evaluate the following expressions, assume the following declaration: int x = 4; What is displayed…
A: The programming languages C, C++, Java supports increment(++) and decrement(--) operators. These…
Q: void functionOne(int number) { if (number < 10) time++; else { for (int i= 0; i< number; i++)…
A: Ans 1: The big oh notation of the first given function is O(n). As per the given function the for…
Q: ?What is the output of the following code #include using namespace std; int main(){ int n=3, x=1;…
A: GIVEN:
Q: #include int main() { int i=7; do for(int j=7;j4); return 0;
A: Here, Program is given to tracing.
Q: Find the error in the following code and explain how to fix it: #include int main(void) int *ptr3;…
A: In this given code you are trying to print value of ptr which is storing the value of m. so you…
Q: QI: tinclude (a) Write two different techniques to declare and initialize a variable with an…
A: Hey, since there are multiple questions posted, we will answer first question. If you want any…
Q: What will the following code output? int number = 22; int *var = &number; cout << var << endl;
A: A pointer is a variable that stores address and can be used to reference or dereference values.
Q: What is the value of t1 after execution of these statements if the value of t2 is as follows: char…
A: Lets see the solution.
Q: int a = 5, b = 12; double x = 3.4, z = 9.1; What are the values of the following expressions? A) b/…
A: Here is the program which execute these statements #include<iostream>using namespace std;int…
Q: fION 15 To assign a double variable d to an int variable x, you writ Ox= d; Ox= (long)d x (int)d3;…
A: This question comes from Programming Language which is a paper of computer science. Let's discuss it…
Q: ?What is the output of the following code #include using namespace std; int fun(int a, int b = 1,…
A: Default parameter value can be assigned using the equals sign If we call the function without an…
Q: What is the output of the following code? #include using namespace std; int doit(int i, int j = 0);…
A: Output is 0
Q: (a) int *ptrl=&a, a; int *ptrl, a; (b) ptrl=&a; (c) int *ptrl; int a; ptrl=&a; (d) int *ptr2, a,…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
By using Pointers Notations and arrays and C language
Step by step
Solved in 3 steps
- Q1) Please someone help me based the program given ,how can I add one feature of "Total sale amount "in the daily report" #include <stdio.h>#include <stdlib.h>#pragma warning(disable : 4996) int main(void){ char category[] = { 'A', 'B', 'C', 'D' };float price[] = { 24.50, 26.00, 27.50, 29.00 };int quantity[] = { 0, 0, 0, 0 };int count = 1;int qtyA = 0, qtyB = 0, qtyC = 0, qtyD = 0;float total = 0.0, discount = 0.0, delivery = 0.0, net = 0.0;char ch = 'A', choice = 'Y';int p = 0;char name[50], ic[20], addr[100]; printf("\n\n<MENU PRICES OF VEGETABLE>");printf("\n===============================================================================");printf("\n Packages Price ");printf("\n===============================================================================");printf("\n A (kangkung,cabbage,Ladies finger,banana) RM 24.50 ");printf("\n B (Yam leaves,long bean,brinjal,guava) RM 26.00 ");printf("\n C (snake beans,broccoli,spinach,papaya) RM 27.50 ");printf("\n D (bak…//I need help debugging the C code below the image is what I was following for directions while doing the code// #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…Write a function using the following header:void printChars(char ch1, char ch2, int numberPerLine)This function prints the characters between ch1 and ch2 inclusive with the specified number of characters perline (numberPerLine). Assume ch1 and ch2 are both either uppercase or lowercase letters.Write a test program that reads two characters and the number of characters per line, uses printChars toprint the characters (pass the smaller one as the first character) with the required format. Characters areseparated by exactly one space.Enter first character: BEnter second character: HEnter number per line: 3The characters are:B C DE F GH
- Write a function using the following header:void printChars(char ch1, char ch2, int numberPerLine)This function prints the characters between ch1 and ch2 inclusive with the specified number of characters perline (numberPerLine). Assume ch1 and ch2 are both either uppercase or lowercase letters.Write a test program that reads two characters and the number of characters per line, uses printChars toprint the characters (pass the smaller one as the first character) with the required format. Characters areseparated by exactly one spaceEach function should accept two integer parameters indicating the minimum and maximum X value to be plotted. The functions should have no return values. Create class-level constants for things we might wish to change later, e.g., a char called PLOT_CHAR that holds an “x” (per samples below), another char called FILL_CHAR that holds an unobtrusive character like ASCII 183, generated with a cast, e.g., (char)183. JAVA PLEASE THOSE ARE NOT PERIODS OR DOTS. USE (System.out.print((Char)183); for (.) Please DON'T USE Loops(while);, if, Arrays, lists, or other data structures, objects, libraries, or methods. Sideways Ploty = 20sin(.5x)+20 where -11<=x<=11 ··································x ·······································x ·······································x ···································x ···························x ·················x········x·xx···x··········x····················x ·····························x ····································x…#include <stdio.h>void cubeByReference( int *nPtr ); // function prototypeint main( void ){ int number = 5; // initialize number printf("The original value of number is %d", number ); // pass address of number to cubeByReference cubeByReference( &number ); printf("\nThe new value of number is %d\n", number );} // end main void cubeByReference( int *nPtr ){ *nPtr = *nPtr* *nPtr* *nPtr;} passing argument by reference - We modify the code above 1- define a second argument (example "int number2 = 9") and a pointer to it 2- define a second function (addByReference) that adds number2 to number - passing both arguments by reference 3- print-out the result (that is in number) Upload the output and .c code
- EXPLAIN THIS CODE EACH LINE #include <stdio.h>#include<string.h>int main(){ char name[20]; int meal,quantity; int drink,quantity2; char choose_meal[30] = ""; int meal_price; float drink_price, orderPrice; char choose_drink[30] = ""; float cash, change; printf("--------------------Marry's Fast Food--------------------"); printf("\n"); printf("Enter your name: "); scanf("%s", name); printf("Hello %s!\n", name); printf("\n\nWhat would you like to order?\n"); printf("------------------------MEALS------------------------\n\n"); printf("[1] 1 pc. Chicken Joy....................Php 76.00\n"); printf("[2] 1 pc. w/Jolly spaghetti..............Php 99.00\n"); printf("[3] pc. Spaghetti........................Php 55.00\n"); printf("[4] pc. Burger steak w/rice..............Php 85.00\n"); printf("[5] pc. Burger...........................Php 30.00\n\n"); printf("Choose a number…#include <iostream> #include "Class_Circle.h" using namespace std; static int x = 5; void setRaduis(int r){ cout<<"I am a function outside the class "<<r<<endl; } int main() { Circle c1; c1.setRaduis(10); c1.printCircle(); setRaduis(20); Circle c2; c2.setRaduis(30); //if (c1==c2) error bool equals = c1.isEqual(c2);//c = &c2 if (equals) cout<<"the circles are equals"; else cout<<"the circles are not equals"; cout << "Hello world!" << endl; Circle c3(40); c3.printCircle(); Circle arrayCircle[5]; int r; for (int i =0;i<5;i++){ cout<<"enter circle "<<i<<" radius: "; cin>> r; arrayCircle[i].setRaduis(r); } for(int i = 0;i<5;i++){ cout<<"the circle "<<i<<" info :"<<endl; arrayCircle[i].printCircle(); } x = 10; cout<<"static x =" <<x<<endl; cout<<"call static func from objct:"<<endl; c1.printNumberOfObjects(); c3.printNumberOfObjects();…Define an enumeration type triangleType that has the values scalene, isosceles, equilateral, and noTriangle.b. Write a function triangleShape that takes as parameters three numbers, each of which represents the length of a side of the triangle. The function should return the shape of the triangle. (Note: In a triangle, the sum of the lengths of any two sides is greater than the length of the third side.)c. Write a program that prompts the user to input the length of the sides of a triangle and outputs the shape of the triangle.
- the code shows me error in line 142 in the class Accomodation cin>>board and 187 abouve the function print unsigned int Request::lastNo = 0; #include <iostream>#include<string> using namespace std; class Date{ private:int daysInMonth [12]={31,28,31,30,31,30,31,31,30,31,30,31};short unsigned int day,month,year; public:Date (int yy,int mm, int dd){ year=yy;month=mm;day=dd; } Date operator+(int n){int newDay = day + n;int newMonth = month;int newYear = year; while (newDay > daysInMonth[newMonth - 1]){newDay -= daysInMonth[newMonth - 1];newMonth++; if (newMonth > 12){newMonth = 1;newYear++;}} return Date(newYear, newMonth, newDay);} friend std::istream& operator>>(std::istream& is, Date& date) {char dash1, dash2;is >> date.year >> dash1 >> date.month >> dash2 >> date.day;return is;} friend std::ostream &operator<<(std::ostream &os, const Date &d){os << d.year << "-" << d.month…Modify the following code with the comment include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <string.h>#include <time.h> int main(void) { int arr[2][2] ={{500, 1000}, {750, 325}}; char name, acc_type; int amt; printf("\nEnter your name:") scanf("%c", &name) ; getchar(); printf("\nWould you like you withdraw from (c) Checkings or (s) Savings:") ; scanf("%c", &acc_type) ; printf("\nHow much would you like to withdraw:"); scanf("%d", &amt); if(name == 'a') { switch(acc_type) { case c: printf("\n Amount in account to be withdrawn from: 500"); printf("\nAmount in account after withdrawal:%d",500-amt);break; case s: printf("\n Amount in account to be withdrawn from: 1000);printf("\nAmount in account after withdrawal:%d",1000-amt);break; } } if(name=='b') { switch(acc_type) { case c: printf("\n Amount in account to be withdrawn from: 750"); printf("\nAmount in account after withdrawal:%d",750-amt);break; case s: printf("\n Amount…C++ Please! Also please don't use functions, arrays, or classes. Just basic c++ please. Password Verifier Write a C++ program to verify that a user’s password meets the following criteria: 1. The password should be at least 6 characters long. 2. The password should contain at least one uppercase and one lowercase letter. 3. The password should have at least one digit. Your program should ask the user for a password and verify that it meets the following criteria. If it doesn’t a message should be displayed telling the user why.