49,761 Topics
| |
#include <iostream> #include <conio.h> using namespace std; void TOH(int d, char tower1, char tower2, char tower3) { if(d==1) //base case { cout<<"\nShift top disk from tower"<<tower1<<"to tower"<<tower2; return; } TOH(d-1,tower1,tower3,tower2); //recursive function call cout<<"\nShift top disk from tower"<<tower1<<"to tower"<<tower2; TOH(d-1,tower3,tower2,tower1); //recursive function call } int main() { int disk; cout<<"Enter … | |
This is a homework problem. I have 5 modules to encode and decode a txt file using the huffman algorithm along with. I'm having some difficulty with where to start with the decoding module. I have to do the decoding using the functions from binary.h and binary.cpp and my priority … | |
How do Vim and Emacs allow the whole console to be used, even after an enter has been recieved? (this can be Windows-specific) I've got unbuffered input, and I have methods for output to print to anywhere in the console. What methods do Vim/Emacs employ to make the entire screen … | |
Hello, Unfortunately I learnt OpenGL from NeHe tutorials, which means that all of my current methods for OpenGL-ing are extremely deprecated. I tried to find a more up-to-date tutorial, but all they seem to do is teach how to get really complicated stuff out of OpenGL. I just want to … | |
I am in introduction to c++ and I have a homework problem that I am trying to do. The problem states display the average high temperature and average low temperature. The program should also display the highest temperature stored in the first column in the array and the lowest temperature … | |
Greetings, I urgently need a book/books for digital image processing can any ne help with books names or books URLs. | |
As naive as this is going to sound, I have to ask it. I have a stream compressed in LZW encoding. I can decompress a stream provided it is in a numerical format. The below I have extracted from a pdf file stream compressed in LZW. I'm assuming the below … | |
The project must include the facilities of a blood bank including the registration of a new use/ donor, blood request, list of blood groups available, searching for the availability of blood. | |
Hello, I need to export some functions in my C++ dll to a client that can dynamically load dlls. That all works, but I am not able to stop the name mangling.I have extern "C" __declspec(dllexport) int __stdcall add( int a, int b ); but the dll exports _add@8 - … | |
Hi all.How to make the ball in pixel art,so i could use perfect round ball in my anumation project? Or how to make perfect shapes | |
I'm tring to make a programe which takes the string from user and save in file(data_file). But I also want to take the .txt file from window and read the file and save in my programe file(data_file). user just give the address of .txt file or any other method in … | |
#include <iostream> #include <cmath> using namespace std; int main() { char flag; float emp_no,basic,da ,hra,pf,tax,net_salary,total_salary; cout<<"enter the basic salary & employee no."; cin>>basic>>emp_no; if(basic<=5000) flag=0; else if(basic>5000&&basic<=15000) flag=1; else if(basic>1500 && basic<=25000) flag=2; switch(flag) { case '0': tax=0; da=(25/100)*basic; hra=(20/100)*basic; pf=(5/100)*basic; break; case '1': tax=(10/100)*basic; da=(25/100)*basic; hra=(20/100)*basic; pf=(10/100)*basic; break; case … | |
I have been working on this for awhile, but I was hoping to get input from someone with more experience. I have to stick with the structure and enum format for the assignment, but I was wondering if anyone had any opinions on the way the high/low temperature sections should … | |
Hi im creating a linked list with these data types etc int account_number char firstName[10] char lastName[10] float total_Balance would anyone give a simple instruction to input/output these. i have tried everything but still doesnt work so far i have done this. #include<iostream> using namespace std; struct account_query { int … | |
Now, i input 1.5, obviously, it will show 1. But how can the program check that i just input 1.5 so that it will show an error for non integer input? #include<iostream> using namespace std; int main(){ int k; cout<<"Input: "; cin>>k; cout<< k ; } | |
how I can modify the ofile object of fstream library, and the remaining data remain save as it was. e.g ofile: hello world name class this is the data ofile have and in modification i want to replace the name with "roll number". after modification ofile became ofile: hello world … | |
I have uninstalled and reinstalled Microsoft Visual about 3 times. I am unable to link or locate the folder #include. This is preventing me from utilizing Visual because it keeps giving me errors and doesn't let me execute the program. I have researched online for various solutions and have re-downloaded … | |
#include <iostream> using namespace std; int f(int i) { if(i == 1) { return (1); } else { return 2*f(i-1); } } int main() { cout << f(5) << endl; //<--- I don't understand why this is 16. return 0; } I am having trouble understanding why f(5) = 16 … | |
i have a file that list all the names and destinations to move the file. so for example a file that looks like this def.txt /names/new/ person.obj /media/people/ panel.jpg /random/pictures/ so as you can see here there are three files that need to be moved in a specific destination. How … | |
i write code for something , now i want to have a printed copy of the softcopy output.How can i get hardcopy output using c++. i think i have to use to include some libraries to the program but i don't know where to get these library or if there … | |
//Description: Binary Search Tree with array implementation, it has inorder, postorder and pre order traversals. //Note: it is not advisable to use array in binary search tree because it consumes a lot of memory in the long run // instead use linked list this is just a reference to understand … | |
Hi there, I know this question is very common but I still didn't understand that why we can't check if array is not initialized. Isn't there a way to check an array is initialzed by any values(int, double). I am working on array based program, in which I have to … | |
#include<iostream.h> #include<conio.h> #include<string.h> #include<stdlib.h> // define maximum number of patients in a queue #define MAXPATIENTS 100 // define structure for patient data struct patient { char FirstName[50]; char LastName[50]; char ID[20]; }; // define class for queue class queue { public: queue (void); int AddPatientAtEnd (patient p); int AddPatientAtBeginning (patient … | |
Greetings, I have some problem with such needed algorithms I know the outlines but I do not know how to implement especially with recursion :( Consider a binary tree **T** of **n** nodes where every node has 4 fields: LABEL (an integer between 1 and n representing the label of … | |
I'm coming up with this error: Unhandled exception at 0x013c4218 in Hash_Table.exe: 0xC0000005: Access violation reading location 0x0000001c. Here's my driver: #pragma once #include <cctype> // Provides toupper #include <cstdlib> // Provides EXIT_SUCCESS #include <cstring> // Provides strchr #include <fstream> #include <iostream> #include <string> #include <sstream> // Operate on strings … | |
// A program to use a run-time loaded DLL.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <Windows.h> #include <iostream> using namespace std; //Creates a new type of variable which is a function pounter called, cryptFunPointer. typedef void (*cryptFunPointer) (int key , char inString, char … | |
This function reads a text file and shows how many times a words appears in the text file, how do I save it to a different text file after running this function? std::ifstream f("test.txt"); std::istream_iterator<std::string> eof; std::multiset<std::string> words( std::istream_iterator<std::string>(f) , eof); for( std::multiset<std::string>::iterator i = words.begin(); i!=words.end(); i = words.upper_bound(*i) … | |
Hi basically I have been trying to set up the irrlicht engine with Visual Studio 2010 and after adding in the inlcude and library file paths it seems as though Visual Studio no longer recognises "stdafx.h" as a valid precompiler?? I know this has something to do with not being … |
The End.