49,761 Topics
| |
| |
1) write a C++ program that reads 50 integer numbers and prints the smallest three numbers. | |
#include <iostream> #include <cstdlib> using namespace std; // function prototype for add int add (int x, int y); int sub (int q, int r); int mul (int s, int t); int divi (int u, int v); int main () { int a,b; char ch; loop:cout<<"ENTER CHOICE OF OPERATION: + - … | |
I was asked to create a program to find word frequencies, word length in a text file. I am able to use map to do the frequencies part but don't know how to sort the the output accordingly to the length of the words. The example output that I should … | |
I have to take a 5 element array and use a function with pointers to make a new array that is one element bigger and shifted 1 place. I have it working so that it shifts one place but the function isn't making the array one element bigger. Any sugestions? … | |
Hi, I didn't know where to place this thread :) Any recommendations for an IDE app to save snippets of code within the program, I looked online, and there are many options, too hard to pick ! :) | |
hey can any one try out this problem.... 1)Write a program to read a sequence of N integers and print the number that appears the maximum number of times in the sequence. INPUT Input contains two lines. First line in the input indicates N, the number of integers in the … | |
Write a C++ program to perform the following: 1) Input a positive integer total that represents the total distance in meters a person needs to travel. 2) Input a positive integer first that represents the distance of the first jump. This distance should be less than or equal to total/20. … | |
I'd like to know main differences between C and C++,because they look similar. | |
I have a server and a client. I wrote handlers for send button and receive. When I send a string I am receiving only first two chars and then some japanese chars of the string on the receive side. I wanna receive the entire string.Please help me . This is … | |
I want to make a project on online examination which have some similar view like amcat and also have a view which run programs online. | |
hi , i have a very simple Family tree project using GUI..... and i have two forms ! the first form ask the user to enter the number of child the parent have then in the 2nd form there will be a box as the number of child like when … | |
hi everyone, i need some help. This is my problem. When I input a string to the program, I want the screen console print out '*'. ex: string s; cout<<"password :"; getline(cin,s); when i type "abc123" for the password. The screen console will show "******". I'm sorry about my poor … | |
i was reading a book and came across this line "C++ matches a pointer of any other type with type void * and prints a numeric representation of the address. If you want the address of the string, you have to type cast it to another type," please any one … | |
when converting iget erros especially in the cin parts because they are automatically passed by something #include<iostream> #include<conio.h> #include<math.h> using namespace std; int p=1; class Bank { public: char name[50],address[90],type; double ein_betrag, aus_betrag; double balance; int costumernr, accountnr, birth, tel; public: void newcostumer(); void newaccount(); void costumerdel(); void accountdel(); void … | |
I am writing a class that uses different policies stored in classes I want to declare this class by simply selecting the policies by writing `my_great_class<policy45, policy22, policy12>` (There can be a varying number of policies) which would translate automatically into: struct empty_class{}; struct policy12: empty_class{ // code... }; struct … | |
A.3 Car rental 3 This program is for a car rental agency. Your program will have to compute the total cost of a rental. This agency has two types of cars, and the rates per day are as follows: All cars come with a basic insurance that covers damage to … | |
I'm having trouble displying the contents of a queue. When I pop the queue here: for( int i = 0; i < diskQueue.size() + 1; i++ ) { cout << left << setw(0) << "--d" << i+1 << left << setw(4) << " " << left << setw(14) << diskQueue.front().getFilename() … | |
Hi! This is just an example code: #include<iostream> using namespace std; int& example() { int a=5; return &a; } int main() { cout << example(); } But I'm getting this error: Error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int\*' | |
I am writing a program to input data from a file, format it and then output to another file. For some reason when i make the file I get this error: ----jGRASP exec: make g++ -ggdb -c Billionaire.cpp iostream:39:0, from Billionaire.cpp:7: c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream: In constructor 'Billionaire::Billionaire()': ostream:384:7: error: 'std::basic_ostream<_CharT, _Traits>::basic_ostream() [with … | |
Hi. Can someone explain why this isn't working? #include <iostream> #include <list> #include <string> #include <iomanip> using namespace std; /** * Global Variables */ int printer; int disk; int cd; int num; int pmem, plen; int dmem, dlen; int cmem, clen; class PCB { public: PCB() : pid( 0 ), … | |
Hi. I'm trying to access some data in a List using an Iterator, but I'm getting an error message: #include <iostream> #include <list> #include <string> #include <iomanip> using namespace std; /** * Global Variables */ int printer; int disk; int cd; int num; string k; int pmem, plen; int dmem, … | |
this code was error.please help me fix it include <iostream> include <conio.h> include <algorithm> using namespace std; int a[]={1,5,7,4,9,8}; BST*binary_search_tree; struct BST{ int value; BST* left; BST* right; }; int search_bst(BST* node,int key){ if(node==NULL) return -1; if(key<node->value) return search_bst(node->left,key); if(key>node->value) return search_bst(node->right,key); else return node->value; } void insert_bst(BST* &treeNode,BST* newNode){ … | |
Hi. Can someone tell me why the following code is giving me an error message? Thank you. #include <iostream> #include <list> #include <string> #include <iomanip> using namespace std; /** * Global Variables */ int printer; int disk; int cd; int num; string k; int pmem, plen; int dmem, dlen; int … | |
Hello I have to do a sorted list code according to some instructions. a friend and I worked on this, and we pretty much ended up with the same code, his worked, but mine isnt, even though its exactly same! I have been trying for hours figuring how to make … | |
Write a program that reads an MxN matrix A and prints its elements in spiral order. You should start from the element in the 0th row and 0th column in the matrix and proceed in a spiral order as shown below. 1→ 2→3→ 4 ↓ 5→ 6→ 7 8 ↑ … | |
create a code that will read a file for an input which is a matrix,(rows and columns of the integers) and be able to output the transpose of it. original matrix 3X4 transpose matrix 4X3 1 2 3 4 1 5 9 5 6 7 8 2 6 0 9 … | |
Write a C++ program that would display the menu of a restaurant and will accept orders, compute for the total amount and compute for customer change after entering the given cash. The program should be looping and will end once the user answers No to the question: Another Customer (Y … | |
here are my codes: #ifndef STUDENT_H #define STUDENT_H class student { public: void enterDetails(); void enterModule(); void displayDetails(); private: char name[100]; char studID[100]; char address[100]; char module[100]; }; #endif i want to add a 2d array "M[row][col]" in my class but i don't know how to do it anyone help? |
The End.