49,761 Topics
| |
I have had an issue with getline(cin,string) in several of my programs. The program does not allow the user to input information after the cout statement preceding getline(cin,string). Below is an example code of the issue I am having(Btw I am using code::blocks with GNU compiler): [CODE]#include <iostream> #include <cstring> … | |
I converted old C++ project to VS.Net 2010 with 4.0 Framework. error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatView:: * )(LPARAM,WPARAM)' to 'LRESULT (__thiscall CWnd:: * )(WPARAM,LPARAM)' [CODE] // .cpp File ON_MESSAGE(WM_ChatAddSize, OnChatAddSize) void CChatView::OnChatAddSize(LPARAM lParam, WPARAM wParam) // .h file afx_msg void OnChatAddSize(LPARAM lParam, WPARAM wParam); [/CODE] … | |
Hi everyone, I'm trying sort a C++ struct and print the result as output file. I don't know how to sort the structure. Did anyone develop this before? Thanks a lot, [CODE] #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> #include <string> #include <vector> #include <sstream> #include <algorithm> #include <cstdlib> … | |
Hi, can someone point me in the right way? I'm running linux and I'm looking for the right include files and commands that would enable me to configure my wifi card. ie create a ad-hoc with another computer, or connect to a wifi router. I don't want to do through … | |
First of all, sorry if my title is not all that descrptive and if this has already been answered, I looked around but did not find it so I decided to make my first post/thread. I am working on a little offline game right now and what I'm trying to … | |
ookay people, here is the code c++; im trying to read BMP image file. [CODE]#include <iostream> #include <fstream> using namespace std; void listing (void) { unsigned char pixel; int x, pix; ofstream debug("debug.txt", ios::out); ifstream inpaint( "source.bmp",ios::binary); if(!inpaint) { cout << "File not opened\n"; exit(1); } for(x=1; x<=54; x++) { … | |
. A small airline has just purchased a computer for its new automated reservation systems. You have been asked to program the new system. You are to write a program to assign seats on each flight of the airline’s only plane (capacity: 10 seats) Your program should display the following … | |
Hi, I would like to ask about sorting lines in C++, (4 columns = 3 columns of integers and the last one a string): 3 56 3 NA 7 50 5 NA 2 100 1 OK I tried the function sort() using a vector of strings, but failed in cases … | |
I can't get rid this error IntelliSense: cannot open source file "stdafx.h" error C1083: Cannot open include file: 'stdafx.h': No such file or directory [CODE]#include "stdafx.h" #include <iostream> #include <cstdlib> using namespace std; //class BinarySearch Tree class BinarySearchTree { private: struct BST { BST* left; BST* right; int data; }; … | |
Hi, I am trying to use some C# code I have written in C++ - its worked fine in the past (without inheritance) so I'm totally stumped by this problem I'm getting. I have made a really simple version, which demonstrates the problem, specifically when it goes into any COM … | |
guys here is the question elow is the main function that creates the object of Mile and Kilometer classes. Write the definition of Mile and Kilometer classes such that each statement in the main function is executed without any error. Both classes must have default constructor that initialize the private … | |
Hey; I am trying to handle the SIGCHLD and therefore prevent zombie processes walking around .) The program does not work the way it should however. I am counting how many times the ZombieHandler is called and at the end of the program it says zero. What might be causing … | |
is there is a tutorial about how to use boost:asio how to send how to recive , coz all the tutorials i checked is only showin me an example of server source or a client source. so please if there is one link me to it thnx alot :) | |
(C++)I need to create a program that would input year and month in number. Display the year and the number of days in that month. The hard part is I need to include the leap year e.g. if the input year is 2000 and the input month is 2 (which … | |
. A small airline has just purchased a computer for its new automated reservation systems. You have been asked to program the new system. You are to write a program to assign seats on each flight of the airline’s only plane (capacity: 10 seats) Your program should display the following … | |
Hi all, Recently I've run into a problem where a string I am reading from a file is being read in with a nonprinting character appended to the end. The character being appended is U+0020. I'm just unsure how to get rid of this. I know that I could just … | |
I wrote a program which finds the next palindrome. First, it takes an input specifying the number of test cases. The code runs fine in Visual C++, but am not able to run it in GCC. I have never used GCC before so unaware with its functioning. But am expecting … | |
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. [COLOR="Red"][B]A brief on problem:[/B][/COLOR] Lets take example problem for simplicity: - I have a GSM network with a cell in it. - Cell's coverage … | |
hi i need your help in these programs using C++ programming language. 1.write a program to enter some numbers and display the count of how many odd and how many even you entered. 2.write a program to store 10 numbers in an array and then display the sum of digits … | |
I am really new to c++ just started today. This is my first real program (however useless it is) and i am stuck with one error. I am writing my code on code::blocks using mingGW on windows XP. My error is as following-invalid converion from 'const char*'to 'char'. my code … | |
I am trying to run the following simple program which uses multithreading using pthreads. I compile it like: gcc -lpthread programName.c and it compiles fine. However, when I run it gives errors which I have pasted at the bottom of program. [code]#include<pthread.h> #include<stdio.h> void *thread_routine(void* arg) { printf("Inside newly created … | |
So I always seem to encounter this error. I usually find some odd hackish fix for it but this time I'm having too much trouble. I'm basically trying to make a program which corrects words the user types in (similar to that of any modern phone). The function I'm posting … | |
Hello I want to implement a pr. queue with structs. My struct is: [CODE] struct Call { int CallNum; long CallTime; int CallLength; };[/CODE] This is a call center simulation application (of course if i can). According to algorithm, the agents should choose the call whose CallLength is shorter. I … | |
Ok so ive written a console program which is great, and now i want to create a thread that makes a window (winAPI) and can commuunicate with the console window. Well to describe it properly, i would like the window thread to send predetermined text (by clicking buttons) to the … | |
dear all i have a dll with COM METHOD functions i want to call.i know the prototype and parameters of each fun. and also return type can anyone help me in calling these functions in details please because i am a beginner in this part. i use vs2010 thanks in … | |
| For example I have 4 sets of Coordinates [CODE] (1,1) (1,3) (3,3) (3,1)[/CODE] It's the out line of a Square Shape Is there a way I can find the list of sets of Coordinates on it's parameter? The expected out put should be: [CODE] (1,2) (2,1) (2,3) (3,2)[/CODE] and is … |
Need some help here it seems to compile fine but crashes at runtime. Am I missing something here? [CODE] #include <iostream> #include <string> using namespace std; // player class class Player{ int *position; public: Player(); Player(int); ~Player(); void print_pos(){ cout << "player 1 is in position: " << *position << … | |
Is there a better way to access the base class operator overload? I'm using casting, and it works just fine, just wondering if there is a better way. Is this bad/ugly code? [CODE]class StrategyKey { public: StrategyKey(){} ~StrategyKey(){} StrategyKey(const char* strA): str_strategy(strA) {} friend bool operator< (const StrategyKey& stratKeyA, const … | |
[CODE]string currentUser() { string user; ofstream outf("CurrentUser.dat", ios::trunc); system("whoami >> CurrentUser.dat"); outf.close(); ifstream inf("CurrentUser.dat"); inf >> user; return user; }[/CODE] This is a function that gets the name of the current active user. It creates a data file, with the contents being the username. The problem is, to create a … | |
I need help with this program, I am new and i am loosing the battle. Write a program that contains a class that implements the days of the week. The program should be able to perform the following on an object of the class: 1. Set the day. 2. Print … |
The End.