Int f ( int number )
}
………………………. ;
{
Int main()
{
Int x = 5
Cout << f (x) << endl;
Return 0;
}
What should be the missing line be ?
……….printGrade (double score) {
If ( score >=90.0)
Cout << ‘A’;
Else If ( score >=80.0)
Cout << ‘B’;
Else If ( score >=70.0)
Cout << ‘C’;
Else If ( score >=60.0)
Cout << ‘D’;
Else
Cout << ‘F’;
{
Void p() {
Int I = 5 ;
Static int j = 5;
I++
J++
Cout << “ I is “ << I << “ j is “ << j << endl;
}
Int main () {
P();
P();
P();
Dear Student ,
As per requirement submitted above kindly find below solution.
Question 1:
Answer :B.int foo ( double x, int y ) {}
Explanation :The function int foo ( double x, int y ) {} will not conflict because this is considered as new function.
*******************************
Question 2:
Answer :B.Return number
Explanation :Below screen shows the output
*******************************
Question 3:
Answer :A.Using functions makes program run faster
Explanation :Using function program may not run faster , function is used for reusability.
*******************************
Question 4:
Answer :B.Void
Explanation :Function printGrade() does not anything hence return type is void.
*******************************
Question 5:
Answer :I is 6 j is 8
Explanation :Below screen shows the output
*******************************
NOTE :PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Three of these function overloads are considered identical by the compiler and would conflict with each...
Am I getting this error because i declared 'n' as an int, and then asking it to make it a double? This is the coude: #include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <algorithm> #include <vector> using namespace std; void sort(double grades[], int size); char calGrade(double); int main() { int n; double avg, sum = 0;; string in_file, out_file; cout << "Please enter the name of the input file: "; cin >> in_file; ...
81. The following function call doesn’t agree with its prototype: cout << BoxVolume( 10, 5 ); int BoxVolume(int length = {1}, int width = {1}, int height = {1}); T__ F__ 82. The following function is implemented to swap in memory the argument-values passed to it: void swap(int a, int b) { int temp; temp = a; a = b; b = temp; ...
Consider the following program: # include <iostream> int x = 3, y = 5; void foo(void) { x = x + 2; y = y + 4; } void bar(void) { int x = 10; y = y + 3; foo( ); cout << x << endl; cout << y << endl; } void baz(void) { int y = 7; bar( ); cout << y << endl; } void main( ) { baz( ); } What output does this program...
I know the right answers by using a compiler. However, can you please explain each step and how you get the correct answer. Thank you in advance. Output: E = 1 F = 7 G = 11 H = 14 W = 5 X = 6 Problem 7 #include <iostream> #include <cmath> using namespace std; void F1(int,int,int,int&); void F2(int,int&,int&,int&); int main ( void ) { int E=1,F=2,G=3,H=4,W=5,X=6; F1(E,F,G,H); F2(E,F,G,H); cout << "E = " << E <<...
howthe output of the following 4 program segments (a) const int SIZE=8; int values[SIZE] = {10, 10, 14, 16, 6, 25, 5, 8}; int index; index=0; res = values[index]; for (int j=1; j<SIZE; j++) { if (values[j] > res) { res = values[j]; index = j; cout << index << res << endl; } } cout <<...
How to turn this file into a main.cpp, a header which contains the function declaration, and a implementation fiel containing the function definition ? #include<iostream> #include<string> #include<iomanip> using namespace std; #define NUM 1 #define MULT 4 void getPi(int iter); int main() { int it; cout << "Enter the number of iterations needed to find PI: "; cin >> it; while (it < 1) { cout << "Error!!! Iteration input should be positive." << endl;...
How can I make this compatible with older C++ compilers that DO NOT make use of stoi and to_string? //Booking system #include <iostream> #include <iomanip> #include <string> using namespace std; string welcome(); void print_seats(string flight[]); void populate_seats(); bool validate_flight(string a); bool validate_seat(string a, int b); bool validate_book(string a); void print_ticket(string passenger[], int i); string flights [5][52]; string passengers [4][250]; int main(){ string seat, flight, book = "y"; int int_flight, p = 0, j = 0; int seat_number,...
I know I'm on the right path, but don't know where to continue from here. This is a C++ assignment Your job is to write that will display a calendar for any given month of a given year. The user will need to type the number of the month as an integer from 1 to 12 (1 is for January, etc.), and the year as a 4-digit integer. This assignment simply requires that your program make use of more than...
C++ Time the sequential search and the binary search methods several times each for randomly generated values, then record the results in a table. Do not time individual searches, but groups of them. For example, time 100 searches together or 1,000 searches together. Compare the running times of these two search methods that are obtained during the experiment. Regarding the efficiency of both search methods, what conclusion can be reached from this experiment? Both the table and your conclusions should...
I have 2 issues with the C++ code below. The biggest concern is that the wrong file name input does not give out the "file cannot be opened!!" message that it is coded to do. What am I missing for this to happen correctly? The second is that the range outputs are right except the last one is bigger than the rest so it will not output 175-200, it outputs 175-199. What can be done about it? #include <iostream> #include...