51,593 Topics
![]() | |
I am trying to open a file after getting its path from the user. here is the code. [CODE]#include <iostream> #include <fstream> #include <string> #include <cstring> using namespace std; void main(){ const char* filepath; string input, input2; char lines[110]; ifstream infile; cout << "Enter filename (including path): "; getline (cin, … | |
Hay guys, I was looking at a few examples of how a Radix sort works, and writing up a document explaining it. I based my findings on one particular example I found, link follows. [URL="http://www.cubic.org/docs/radix.htm"]http://www.cubic.org/docs/radix.htm[/URL] Well the bit shifting here is giving my head a bit of a spin, and … | |
I'm currently working on implementing a small game in C++, but when trying to compile, I get this error: [CODE]..quadtree.h:125: error: no matching function for call to 'Fleet::Ship::overlaps(const Fleet::Ship*&)' ..ship.h:40: note: candidates are: bool Ship::overlaps(const Rectangle&) const ..ship.h:85: note: bool Ship::overlaps(const Ship&) const ..ship.h:32: note: bool Ship::overlaps(const Point&) const[/CODE] So … | |
This question is for all the programmers. What makes a good prgoammers? What made you get a job? Why are you a programmer? This is not a interview, or nothing like that. This is just someone that is curious about those question. Thank you for answer or even viewing this … | |
i have a training application which incorporates c/c++ and raima database(a database system written in c) i was able to insert some data in it but i cant read from it. the files are as follows: Books.cpp : [CODE]#include "Booksh.h" #include <iostream> #include <string> using namespace std; info bookrec; Books::Books(void) … | |
Can someone help me with the follow: How would you implement mergesort without using recursion? | |
i am using a c library from c++ application and i need to fill a c struct from c++ code, this is a c++ console application. it doesnt seem to work when i assign variable values using cin. what should i do ? | |
hi. i am looking to run the following queries from the project zipped with this message: 1. List all lecturers in alphabetic order by surname within a selected department. 2. List all lecturers within a selected faculty. 3. List all modules taught by a selected lecturer. i am having trouble … | |
hello,i am new in the forum i want from any member in this forum solution this equation (in the insertion any equation for example this (sum=sum+5;) this equation not enduring ) shown in the screen or to be product: sum identifier = operator sum identifier + operator 5 number ; … | |
hi....i'm trying to write a code that generate random numbers quickly because i'll iterate my code a lot of times.....millions of times.... I use srand(time(NULL)) to initialize the seed, and random(RAND_MAX) to generate the random number, but this form is annormally slow I need help to reduce the time of … | |
The following function mixes call by reference and call by value parameters. [ICODE]void T ( int & a, int b ) { int c = a - 1; a = c + b; b = a + 2; }[/ICODE] Suppose that in main we had the following: [ICODE]int apple = … | |
Hey, I'm somewhat new to programming in c++ and I have had this code I wrote for a long time now. I wrote this about 9 months ago when I was really interested in learning the c++ language but lost interest during the summer. Well, now I'm getting back into … | |
Hi, I'v written this code for an Assignment however I was wondering if anybody had any suggestions on how to change the loops from IF/ELSE statements to Do/While, if that would be possible just the rest of the guys in my class are doing it this way with IF and … | |
error: cannot converst 'std::vector<int, std::allocator<int> >' to 'std::vector<int, std::allocator<int> >*' for argument '1' to 'void(...)' Well, he cannot convert a vector to a pointer to itself, as it is passed to the void function, where I wish to manipulate it.... I wish to operate on a vector containing about 20. … | |
If there are two arrays arr1[]={1,4,5,6} arr2[]={1,5} I want to get the output as arr[]={4,6} i.e i have to remove all the common elements that arr1 and arr2 have and printing the required output . Can any one give me the program in C++ for this with normal looping techniques? | |
Can any one slove this question? It is really hard. [url]http://img168.imagehshack.us/img168/7080/task3vn7.png[/url] I don't know how to write it in c++ but i have write up the programing logic that should work for this question. | |
Hey i need help with the final assignment of my Microsoft Visual C++ class and its a hard one its an online address book where it keeps a bunch of information such as name id birthday and etc. i know it looks messy but if you copy paste into the … | |
Hello Friends, I am trying to porting some pre-existing code to VC++ 2005 in Win XP environment. I have a segment of code like, [code] ... #include<fcntl.h> #include <sys/types.h> #include <sys/stat.h> ... ... cm_iFile = open(l_chBuff,O_RDONLY|O_BINARY); ... [/code] During compiling this file I am getting the following error message, [B]..\source\CRaterEDRFile.cpp(276) … | |
The program is all working now, but I'm worried because on the last linked lists assignment I got a C because I did not do the link correctly. My prof said that I did not create the links up correctly just used a stack to get descending in the last … | |
26. What is printed in the following code segment? [ICODE] I = 1; do { I = I + 25; } while ( I > 50 ); cout << I + 50; [/ICODE] a) 50 b) 51 c) 75 d) 76 | |
Hey, This is the same code as my other forum for those of you who were helping me there. It is all working now, but when I go to call return_value from applicant.cpp(it has to be .cpp not .h because thats how the prof made it) Its coming up with … | |
23. To convert Fahrenheit ( F ) temperatures to Centigrade ( C ) temperatures people use the formula: (32 degrees F is 0 degrees C, 212 degrees F is 100 degrees C, etc.) double C,F; [ICODE]cin >> F; C = ( 5 / 9 ) * ( F - 32 … | |
14. What will be outputted given the segment of code, if 11 is entered from the keyboard? int number; [ICODE]cin >> number; if ( number > 0 ) cout << "C++"; else cout << "Soccer"; cout << " is "; cout << "fun" << endl; [/ICODE] | |
Hi I have defined the class in C++ file as __declspec(dllexport) int clsName ::CreateDocument(char* filein, char* fileout, char* config) where clsName is the class name But after I compiled the code and use the dll in .net code I am getting a run time error "Unable to find an entry … | |
Hey, I am having problems with this code, I think it is not linking up the whole file, because when I run it it only says "hi" 3 times. And also it keeps crashing because of best[i] = point->item->return_value(); [code] #include "applicant.cpp" #include <iostream> #include <fstream> #include <iomanip> using namespace … | |
Hello everyone....again. I have a program that is using a queue. I have a class member function that is to traverse the queue, and output the smallest number in the queue. Pseudo for this function is: Compare the front and front->next. Whichever is smaller, keep it. Traverse the queue until … | |
I'm getting a strange compile error with getline. My question is if you make a statement like: [CODE] getline(is, a.lastName, ','); [/CODE] can you revert back to: [CODE] getline(is, a.country); [/CODE] Or in other words, once you set a delimiter, are you bound by that delimiter for the rest of … | |
First, let me introduce myself. I was a pretty good C programmer, back when [and very modest as well.] I got into other lines of work and have been out of programming for several years. The other lines of work have ... you have read the headlines, right? I need … | |
The program i made below is a c++ program. All I ask for is some feedback of my program. This program has a menu of option, but I have only implemented option 1,2,3,7thus far. So here is the code. [code] #include<iostream> #include<ctime> #include<cstdlib> #include<cmath> #include<string> using namespace std; void MemoryMatchingGame();//The … | |
Can you please help me with the source code solving this task under C++/G++ (linux) or dev C++ (windows) [img]http://mail.dir.bg/~storage/cPlus_plus111.jpg[/img] Below you can see a hint for solving Exercise P14.1 but I need to write the source for [color=red][b]Exercise P14.1 [/b] P[/color]lease help me http://www.horstmann.com/bigcpp/solutions/ch14/ExP14_1.cpp [code] #include <string> using namespace … | |
I am working on a project and I have run into an issue with populating a 3d vector array. When I try to complile the code below I get the following error. no matching function for call to ‘std::vector<std::vector<std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> > I am not sure where I went wrong … | |
I am working on a program and this what I must do, Create a class based on TMoney. TMoney only contains three denominations, tdollars, twons (worth 1/5 or .2 of a dollar) and tpennies. Create an array of three Tmoney objects. Use a loop to input data into each of … | |
I'm making an app that needs to safely remove USB Drives and SD cards. When i execute my code,the drive gets forced not to be ready. I have an old 128MB usb drive and when i start transferring data to it and execute my code,a msg box pops up saying: … | |
Yes, I have the do while set to go on forever until I get on to the solving part, but while trying to shrink my program down so I can make it more modular, the O's that player 2 have are showing up as a face? I know I have … | |
Hello everyone, I just started learning c++ and I started with creating a programme that gets your wan ip adress. Just because it covers some basic stuff. Getting the content of the website works fine. But the parsing doesn't really work. If tried with sscanf, but it didn't work. Also … | |
The below code, is a source code which i am trying to learn double linked lists from, as for a 2nd year assignment. For some reason my editor keeps returning the error messages [icode]'cout' : undeclared identifier 'cin' : undeclared identifier[/icode] Can someone please help me?? All help is VERY … | |
I'm trying to write a DNS server and I need the IP/name mappings to delete themselves after a given number of seconds. How can I accomplish that? Thank you | |
For a class assignment we need to make a C++ program in putty of the game war. It has to have 7 functions; it's suppose to use a time() function and srand() function in the dealRandomCard() function. The output should be asking you how many cards you want to play; … | |
im making a grade book code using functions and SINGLE arrays (multi arrays would be easier, but my teacher wants this in our code) outline: from main() ask the user for info about 4 students ---> use functions getStudentInfo() 4x (once per student; im assuming this will have the students … | |
The output from this only returns the letter 'C' in the path string. Help! Wizzsm. std::string GetServiceConfig() { HKEY keyHandle; char rgValue [1024]; LPCTSTR regPath = L"SYSTEM\\CurrentControlSet\\Services\\ApirbiService"; LPCTSTR regReq = L"ImagePath"; DWORD size1 = sizeof(rgValue); DWORD Type; if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, regPath,0, KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS) { RegQueryValueEx( keyHandle, regReq, NULL, &Type, … | |
Please can someone show me how would I create a file using fstream that would take the contents from another existing file and user input sentence. for example: I have file1 with some contents The user inputs a sentence Now I want to create a file using streams that has … | |
I'm having trouble inserting a bubble sort for my program, any help would be appreciated. #include <iostream> #include <string> using namespace std; int main() { string food[100]; string lookup; int calories[100]; int x = -1; do { x++; cout << "Enter a menu item (enter 'done' when finished): "; getline(cin,food[x]); … | |
Ok so i got part of my code written out but i dont understand how to go about checking all the numbers to see if it is a valid soduku code. i need a function to check the puzzle and make sure it is correct and if it is not … | |
To any and everyone :) As stated in my title, this is a homework assignment, so I appreciate any help or suggestions that are given. Also, per the website rules, I have put effort to this, and I'm not asking anyone to just do my work. (The program compiles and … | |
I'm currently writing code for a soon to be simple tic tac toe program. Currently i'm just testing out methods of how to run it, so it'll be more "modular" in the end but for now I'm just testing things out. My question is, how would I go about validating … | |
Lets say we have appA and appB. appB is running in the background, not doing anything. Then the user opens up appA. They punch in a number, and hit enter. Then appA "pokes" appB and sends it the number. appB multiplies the number by 5, pokes appA and sends it … | |
Hi! I'm new to this forum and C++ programming and I am currently taking and introductory course to C++. I have a program that compiles fine but will not execute. I am posting my code and a sample input file....Please if anyone can get it to run or give me … | |
This is part of a larger program and this is the only part that I can't get down. Right now, it runs fine once through, but telling it yes to repeat the loop at the end does not allow the user to input a new name for student once the … | |
Below is the code I am starting with. What is desired is to have the user input the number of players and the number of scores and then populate the players and scores. To check the program out I usually will use random numbers for the scores. My problem is … | |
Wasn't sure where to post this, I couldn't find a relevant forum. Whats the LGPL and how does it differ from the GPL? |
The End.