Computer Science Question
Q: int fun(int k){ return ( ); void main(){ int n; cin >> n; n = n * fun(n); <-- 1 Fill in the…
A: Your answer is given below as you required with an output.
Q: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: This is about classes and the constructors.
Q: #include using namespace std; int main() (char names[12][10]={"ahmed", "alaa", "hussain", "mahmod",…
A: Given C++ program contains a two dimensional array which contains six strings. Then it contains a…
Q: #include using namespace std; class SobolooSoba { int Komi(int num1,int num2) { return num1+num2;…
A: Given: A C++ program using the function overloading concept is provided. The functions are capable…
Q: #include void main() { int i; int number[11]={12,15,17,3,2,7,10,10,15,15,50}; for(i=0;i< 11; i++){…
A: Over here array is given which has 11 elements and we have to find a Maximum, Minimum, and average…
Q: CONVERT THIS TO JAVA PROGRAM #include #include using namespace std; int main() { int n;…
A: #include <iostream>#include <iomanip>using namespace std; int main() { int n;…
Q: #include #include using namespace std; //hasHelpOption() definition int hasHelpOption(int argc,…
A: Your program gives the following warning on compilation: It is because the compiler can not tell…
Q: #include using namespace std; int main() { int a[100],n,i,item,loc=0; cout>n;…
A: Sample Response: #include <iostream> using namespace std;//function to search a key in the…
Q: Code: #include using namespace std; void BUBBLE(int A[],int N){ for(int k=0;kA[ptr+1]){…
A: Explanation: To remove the function from the program and writing everything into a main function is…
Q: / Question: Implement a C++ program to calculate the factorial of a number using recursion.
A: I have provided C++ CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT...
Q: #include #include using namespace std; // A function for genrating random number between range…
A: Program: #include<stdio.h> #include<stdlib.h> // A function for generating random number…
Q: Outputs of the following: void main () { int M[3]; int "ptr; ptr=M; *ptr=100; ptr++; "ptr=200;…
A: void main(){ int m[3]; //declaring an array int *ptr; //declaring a pointer ptr=m;…
Q: c++ int * board; int rows; int columns; cout > columns >> rows; cout << endl; board= new…
A: Arrays are basically of 2 types:1. Static arrays.2. Dynamic arrays. Static arrays:- Array in…
Q: Explain this C code line per line please #include #include void printArray(int**,…
A: #include<studio.h>//defining header file # include <malloc. h>//header file for…
Q: Run the Debugger on the program several time. Trace the execution of the the function oubble sort.…
A: Import necessary packages to get the standard input-output. Define two functions as print_array and…
Q: Remove error from following cpp program: CODE: #include #include using namespace std; class…
A: Step 1:- Error:-
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: int i,j; for(i=1;ii;--j) cout<<"-"; } **_* ** **. ***.
A: CODE WITH OUTPUT:-
Q: What is the ouput of the following C code segmer void * T( void* me) { int s=0; for (int k=1; k<=me;…
A: It is defined as a powerful general-purpose programming language. It can be used to develop software…
Q: #include #include using namespace std; int index1(char *T,char *P) { int t=0,p=0,i,j,r;…
A: To remove function, use all statements outside the function and remove the function header. instead…
Q: Briefly explain what this code is doing and also give its output when n=3. #include using namespace…
A: The code is a C++ program that takes an integer input n from the user, and then enters a while loop…
Q: Range based for loop is relatively new in C++. It provide a neat way to iterate a sequence. Refer…
A: Answer-1-: Initialization-: i=100 Condition-: n!=i increase-: ++n Initialization-: n=0 decrease-:…
Q: Computer Science There are multiple errors in this code. Please list all the errors in the following…
A: In the given code, the following errors are:
Q: bie World ------------ input 10 2 4 9 output YES */ #include using…
A: The code you provided appears to be written in C++. It takes input values and performs a bubble sort…
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: In this code snippet that performs a binary search, what code should replace the placeholders…
A: The question asks to choose the correct expression and statement to replace placeholders in a binary…
Q: include using namespace std; void DeleteElement(int *LA,int ITEM,int &N,int K){ for(int…
A: Please find the answer below
Q: #include #include using namespace std; class Fraction { public: int numerator; int…
A: Output of the given Program: The product of 9/8 and 2/3 is 18/24 The quotient of 9/8 and 2/3 is…
Q: // index <- find the index of the RECORD with given restaurant_id in restaurant_array ????? (I…
A: The index of the RECORD has to be found with given restaurant_id in restaurant_array and if no id…
Q: #include using namespace std; class test{ public: test(){ cout<<"alpha\n"; } ~test(){…
A: Given: #include <iostream>using namespace std;class…
Q: #include using namespace std; class test{ public: test(){ cout<<"
A: Code: #include <iostream>using namespace std;class…
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: #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: void add(int *ptr1, int *ptr2, int *val) { *ptr1 += *val; *ptr2 += *val; }
A: #include <stdio.h> void add(int *ptr1, int *ptr2, int *val); // defination of add function…
Q: #include using namespace std; void insertElement(int* LA, int ITEM, int N, int K) { int J=N;…
A: Step 1:- Program Explanation:- 1.In this program, we insert element 6 at the index of 3 in the array…
Q: #include using namespace std; class st{ private: int arr[100]; int top; public: st(){…
A: this is user friendly code to understand it easily. we use switch condition to make user friendly…
Q: The general form of (One- Dimensional Arrays) is:Type Array Name [number of elements] * O True False
A: The above question that is in program is incomplete question here i am answering the question…
Q: include using namespace std; int MSD(int n){ if(n == 0) return 0; int k =…
A: Understanding the Function of the CodeThe given C++ code is intended to find and output the Most…
Q: #include using namespace std; char* duplicateWithoutBlanks(char *word) { int len = sizeof(word);…
A: Program changes: Make the method duplicateWithoutBlanks() void. char* str and counter k is suffice.…
Q: int binarySearch(int arr[], int n, int k) { int start = 0; int end = n-1;…
A: The code you provided appears to be a C program that implements a binary search algorithms along…
Q: Input 1. integer n 2. N integer values Output Enter n: 5 Enter value # 1: 3 3 is odd Enter value #2:…
A: I give the code in C++ along with output and code screenshot
Step by step
Solved in 2 steps with 1 images
- #include <iostream> using namespace std; class SobolooSoba { int Komi(int num1,int num2) { return num1+num2; } int Komi(int num1,int num2, int num3) { return num1+num2+num3; } }; int main(void) { SobolooSoba obj; cout<<obj.Komi(20, 15)<<endl; 3 cout<<obj.Komi(81, 100, 10); return 0; } The question above contains a bug, correct it and determine the output#include #include using namespace std; int main(int argc, char const *argv[]) { char s1[6] "Hello"; %3D char s2[6] "World"; char s3[12] %3D = s1 + + s2; cout<Q.1. Explain working of a Proxy serverby functionality i.e., by providing secure Internet access to users, reducing cost and providing security. Explain node to node communication.#include<bits/stdc++.h>using namespace std;bool isPalindrome(string &s){ int start=0; int end=s.length()-1; while(start<=end) { if(s[start]!=s[end]) { return false; } start++; end--; } return true;}int main(){ string s; cout<<"ENTER STRING:"; getline(cin,s); int n=s.length(); bool flag=true; for(int i=1;i<n;i++) { string lowerHalf=s.substr(0,i); string upperHalf=s.substr(i,n-i); if(isPalindrome(lowerHalf) && isPalindrome(upperHalf)) { flag=false; cout<<"String A is:"<<lowerHalf<<"\n"; cout<<"String B is:"<<upperHalf<<"\n"; break; } } if(flag) { cout<<"NO\n"; } return 0;} change to stdio.h string.h#include <iostream> using namespace std; int main(){ int a[100],n,i,item,loc=0; cout<<"Enter number of elements: "; cin>>n; cout<<"\nEnter numbers:\n"; for(i=1;i<=n;i++) { cin>>a[i]; } cout<<"\nEnter number to search:"; cin>>item; for(i=1;i<=n;i++) { if(item==a[i]) { loc=i; break; } } if(loc>0) { cout<<loc<<" is the location of item"; } else cout<<"\nno. not found";} Q: edit the code that shows after how many number of iteration searched value is foundConsider the producer-consumer problem where the producer produces items to be consumed by the consumer. A solution of the problem is to be implemented using threads. The main process will run producer and consumer as two different threads. The producer will put the items it generates into a buffer of length 15. The consumer reads the elements of the buffer to get the items. A solution is given below. Each item produced and consumed are also printed to the screen. Run the program several times and find a sample run when the items produced are not correctly consumed. Explain why the program does not always work correctly.#include<bits/stdc++.h> using namespace std; void bubbleSort(int arr[], int n) { for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } } int binarySearch(int arr[], int l, int r, int x, int& comp) { comp++; if (r >= l) { int mid = l + (r - l) / 2; if (arr[mid] == x) { return mid; } if (arr[mid] > x) { return binarySearch(arr, l, mid - 1, x, comp); } return binarySearch(arr, mid + 1, r, x, comp); } return -1; } int main() { int Num[8192]; srand(time(NULL)); for (int i = 0; i < 8192; i++) { Num[i] = rand() % 10001; } clock_t starting_time = clock(); bubbleSort(Num, 8192); clock_t ending_time = clock(); clock_t result =…using namespace std; int main() int i, m=0,n=4; float arr[100] (55,66,88,1); for(i=0; i## Q3. Finding the largest number from three numbers. **C++ #include using namespace std; int findLargest3(int a, int b, int c) { int largest; // Put your code here return largest; int main() { int a, b, c; cout > a; cin >> b; cin >> c; cout << "The largest number is " <« fingLargest3(a, b, c) « endl; return 1; *Hint 1: Considering the case that the two or three numbers are equal.*5- int arr[4]= {2, 4, 5, 3); for (int i= 0; i<4; i++) cout<Question p.this is c++ language Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this line2- The factorial n! of a positive integer n is defined as n! = 1*2*3 . .. * (n-1) * n Where 0! = 1 Write a function to calculate the factorial of a number. Argument: A number n of type unsigned int. Returns: The factorial n! of type long double. Write two versions of the function, where the factorial is • calculated using a loop calculated recursively Test both functions by outputting the factorials of the numbers 0 to 20.Recommended textbooks for youDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill EducationDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSONC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag…Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education