49,761 Topics
| |
Can anyone tell how really these functions work???? 1.cin.ignore() 2.cin.clear() 3.cin.good() 4.cin.fail() 5.cin.bad() 6.cin.eof() I mean to say what values these functions return at what situation... thank you! I also need to know about some user input validation techniques.i.e. the user inputs valid data in the programs.....e.g.if there is some … | |
Hi This whole pointer thing is getting the better of me. first i have a call to method "convertToCString" in my main: [CODE]int value = 21; char* cstr = NULL convertToCString(value, &cstr); printf("\"%s\"\n". &cstr); cstr = NULL delete cstr;[/CODE] the method looks like this [CODE]bool convertToCString(int& refConstInt, char** ptrtoCharPtr) { … | |
Hi Guys, i wrote a program that starts another thread. In one case i thought that i have introduced a memory leak and i should get a segmentation fault but i didn't !! That's kind of puzzled me so i decided to post it here. [code=c++] #include <iostream> #include <windows.h> … | |
Hi, I am working on a project that involves a simple stimulus-response agent which much navigate it's way around a 2d grid world. Does anyone have any good ideas for ways to implement the agent's visual field? The input is a string of characters, one of them representing the position … | |
Hi, I just started my C++ class a couple weeks ago and I am stuck and having a really diffcult time understanding which commands to use in my programs. I don't even know where to look to get a list. Anyways, basically what we have to make our program do … | |
Ok, something very wrong is going on with my program. When i run it the numbers it is giving me are sometimes right but are also wrong. H (the first letter in the word) is both = to 0 and 1 (wtf?). Any ways below i'll show you want i … | |
Hello all, I am trying to use the #if directive to compile extra functionality acording to some class template parameter defined integer constant. What I want to do is this: [code=cpp] struct A1{ static const int _AINT = 0; }; struct A2{ static const int _AINT = 1; }; template< … | |
I am trying to get a program working, and im half way there, I think. What the program must do is take input from the keyboard and then capitalize every first letter of every word. Here is my entire program so far... [code] #include <stdio.h> #include <iostream> using namespace std; … | |
Hi i have a requirement where a cpp file should load a dll viz gzip.dll.then the cpp should call few methods in the dll.well im able to call the methods with no parameters but im unable to call the methods with parameters.if im trying to call methods with parameters i … | |
Hi !!!! I want to write a program that print the character # like a triangle in the middle of the page.I mean like this : # # # # # # # # # # # # # # # # # # # # # # # # … | |
// Sum of Squares and Cubes.cpp : Defines the entry point for the console application. // [code=cplusplus] #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int n,j; cout<<"Enter a Number:"; cin>>n; for(j=1;j<=n;j=j+1) cout<<j*j<< " "; cout<< endl; int a,b,c,sum; a=n+1; b=2*n+1; c=n*a*b; sum=c/6; cout<<"the sum … | |
Is there a way for me to use an obj-C class with my C++ program? If so, what special parameters do I have to specify during the compilation phase, and if I needed, changes to my source code files?:-/ | |
I have read prior post on the forum but I came up with few specific questions about Porting Unix Socket(hereby calling it BSD socket) to Win32 Platform : First of all, I am a native Linux C/C++ Programmer. I program in Ubuntu with GCC. But, I usually also port my … | |
Hello, I looked around and saw similar problems, but None of the answers seemed to help my situation. Im almost done with my HW Just have come across this minor bump. The error is in the title, and is happening in my addressEntry header, or cpp. not sure: : error … | |
Hi friends.. Last day at school my teacher gave the following code.. But it is not working.. 16 errors.. I am a beginner in C++ .I badly need your guidance a help in finding the errors... the for loops is all wrong.. To be frank I don't understand the working … | |
[B]cannot convert parameter 1 from 'char' to 'char *'[/B] calcCharges(type_of_gas, &rate_of_gas, number_of_gallons, &total_gas_of_price, car_wash, &price_of_car_wash, &total_cost); | |
Ok, stuck on homework. The program is supposed to read a list of presidents from a binary file and display them. I have it all working..except..when it gets to Truman...it just keeps repeating his information. I know its still going in the loop, but for some reason the pointer stays … | |
hello, dear all. below is my program code. the problem is an half of my output is zero for entries of matrix for n greater than 4. [code=cplusplus] #include <stdio.h> #include <stdlib.h> #include <iostream> #define MAX 100 int num[MAX][MAX]; int n; int nrows = 0; using namespace std; void print(int … | |
Hello, I am fairly new to C++ and am having a bit of trouble reading in a text file to my program which contains numbers(integers) and names(strings) and checking for spaces in the names(strings).I basically am reading in a .txt file which contains numbers and letters. In this file, the … | |
When declaring get_color and get_size, my compiler gives me errors, and I don't know how to solve them. It's probably something really simple, but I think the more I try at it, the more messed up my code becomes (hence the 'this' and '->' references) marble.cpp(11) : error C2143: syntax … | |
Im writing my final project and i have everything in one .cpp file and i was wondering if someone could tell me in detail how to go about putting things in their own file and leaving the main function by itself in the main file. for example i have some … | |
Ok so i made a decoder for this that gets the letters from the numbers that this encoder gets. Problem is that i think the numbers its giving me are wrong and i can't seem to figure out whats causing the problem. Help please! :( [CODE=C++]#define _CRT_RAND_S #include <iostream> #include … | |
This is what I'm suppose to do: "Create a while loop to read in the corporate sales data from the pgm3.dat file and create a report listing data for each division as well as some of the summary data described in Programming Challenge 12 in the textbook. Inside the loop, … | |
Hi [CODE]int** numberLists = new int*[count];[/CODE] I'm having difficulties understanding this line of code, I've just started programming in c++. I think I got the basics of pointers but I can't find any helpful "enough" info about arrays of pointers. I understand that an array of pointers to integers is … | |
Hi! I wrote two functions in order to access two private data members of a template class and I got the messages in the title every time I call these functions(getNcols(), getNrows()). I'd be very grateful for your help, guys... (Without the "template<class T>" before the friends, I got linker … | |
When i runt he code and try to get the size of the 2 files something goes wrong with the msgIn file. I'm using the same method for both files and the bookIn will work but msgIn just returns 0 as if it never ran. this is the method that … | |
Hi, does anyone know what the message 0xc088 is? My PeekMessage(...) loop is getting this message code, but I cannot find it in the header files (grep'ed c088). It seems to be intersperced with WM_PAINT messages. | |
Im trying to get my program to list certain types of drives etc but i dont know all the drive type names like "DRIVE_REMOVABLE" or "DRIVE_CDROM". does anyone have a list of the entries? | |
I'm trying to get a char back from the bookFile.txt but, when i run the program it returns nothing. I'm not sure if .get() if the right thing to be using. When i run this code i get the random number and the first letter of the msgFile.txt returned correctly. … | |
I have a project where I have to analyze 3 different hashing functions. I cannot get the cyclic shift hash to work with a bitwise OR. Everything looks fine to me am I doing something wrong? [code=cplusplus]int Hash::hash(string key) { unsigned int h = 0; for(int i =0; i < … |
The End.