Sorry about the beginner question, but I am sort of stumped.I have a program that asks the user for the title of the window should be, then adds "title " to the beginning and calls system(UserEnteredTitle); But i get an error message that says error C2110: cannot add two pointers. How can I set a us...
I need help debugging this small piece of a program that I am making right now. My topic is: Develop a medical program to identify common childhood illnesses based on the symptoms exhibited. I researched illnesses and symptoms and started to put a spreadsheet together to group the symptoms that are...
I had a class on C++ a few years ago and I am trying to brush up the little skills I have of this language. I am creating a program that lets you choose from 4 different games. When I choose a game to play it automatically goes to the first one no matter what game I choose. It also skips one of t...
225 byte By
Vaderman at 2007-12-3 19:25:54
If i have 5 STL lists with, lets say, 10 different numbers that are unique to each list, is there a way where, in STL perhaps, I can just sift out all the numbers that are common to all 5 lists?<br/>Regards<br/>John
384 byte By
BrianB at 2007-12-1 0:34:59
(I am using borland builder 6)I have a std::string , of variable length, that contains hex. The hex is guaranteed to be the equivilent of numbers, not characters (its source is a field in a packet).How would I convert this hex string to an int ? I was thinking sprintf, but i dont see how. Please pos...
1895 byte By
earthwyrm at 2007-11-29 14:56:30
Hey all,I've got a problem with a piece of code I'm writing, I'm trying to write a function for STL containers with shape pointers that would iterate the container given as an argument and execute a method. code usage in main method:showall(vs); // where vs is a vectorshowall(ls); //...
I need to make a vector of character arrays for a program I am writing but I can't figure out how to do it. I'm new to C++ - I tried doing:<br/>vector<char*> v;<br/>but it didn't seem to work properly. How would I go about doing this?<br/>Thanks much
377 byte By
George2 at 2007-11-25 11:50:04
Hello everyone,Suppose I have two enums which has an item with the same names -- but different values,enum foo { NAME = 100;}enum goo { NAME = 200;}Are there any ways to specify whether I need to access NAME in foo or NAME in goo?thanks in advance,George...
3500 byte By
wolfblade at 2007-11-25 11:50:00
OK, so I'm just starting out, and I decided to put together a guessing game for my first console program. I managed to do this, and even put in a little wrong input prevention, but I was not able to get exactly what I wanted. Here's what I already have (I hope I did notation right, I...
301 byte By
MFCQuery at 2007-11-25 11:49:58
If i have some c++ library and i want to use this library in MAC OS then what extra work i need to do?When i use these c++ library on windows there is no problem at all. But when i use on MAC then i get run time error and program is terminate.Please give any link if it's available...
ok, i'm working on this calendar program, and i've searched around here on thise site for similiar posts, but in the other calendar programs i don't get what they are doing, so i've been writing this, and am almost done with it just needs a few things#include <iostream>#inc...
hello everyone,i am working on kruskal algorithm using disjoint sets.here's what i have for now:#include <iostream>#include <fstream>#include <stdio.h>using namespace std;void makeset(int);int findset(int);void unionset(int, int);void linkset(int, int);const int nmax = 1000001...
Ok I had a program that asked the user for a number. Then displayed the multiplication table for that number 0-10. It used the function prototype and code the function definitionsint getNumber( );void displayTable(int);and it used a loop to calculate and display the table. I have the .exe file but...
Hi guys,I read everywhere that RTTI can only work if you have at least 1 virtual function.I use this code:#include <iostream.h>#include <typeinfo.h>class X{ int i;public: void f() {i++;}};void main(){ X x1,x2; if(typeid(x1)==typeid(x2)) cout<<"same!"<<endl;}As you can s...
Does anyone know where I can find the syntax of using Regular Expressions in C++ ? There is plenty of tutorials and examples on using RegEx in Perl but not so much for C++.I'm using the Borland Compiler Command Line which is apparently from the Borland Builder C++ 5.x compiler. Thanks...
My question is: I dont know which creational design pattern to solve the problem below:I have a "main" class I call Sentinel which monitors all the threads that are created. If any of the threads dont finish on time or died, the Sentinel will be able to detect this and report to user.Let's take...
ok this is a simulator incorporating the rules of movement for the game of monopoly.#include <string>#include <iostream>#include <fstream>#include <cstdlib>using namespace std;#include "dice.h"const unsigned int MAXSQUARES = 40;const unsigned int MAXPLAYERS = 4;const unsigne...
First I should state this program has been running for 3 years just fine and I am not sure what the reason is for it suddenly not working. I just got the new version of MSVC and installed the new BOOST so maybe that's the issue.Any how, I have 2 vector stucts of mostly strings that I am trying...
1197 byte By
Zenlakin at 2007-11-25 11:48:53
Hello all. I am not in a programming class per say. It is actually a modern operating systems class and our teacher asked us to work out this little lab. It is not for any points but just to help us understand the concept of when deadlocks occur and such. Here is the lab:Code the Bankers' algor...
317 byte By
genossa at 2007-11-25 11:48:52
Hello everyone!Have a couple of tricky questions here1. Is there a way to get the vendor name of the installed PnP monitor?2. Is there a way to get the vendor name of the installed PnP monitor having its Vendor ID and Product Identifier from the EDID data block?Thanks,Gennadii...
1573 byte By
ze1 at 2007-11-25 11:48:43
Hi, I'm making a C program (not C++) and I have a problem.I've created this data type:typedef struct { char ArrayChar[9] ; int Probability[9] ;} tpBoard ;and I need to store a variable of the type tpBoard inside a list but the value of is of the void type:This is the node:typedef struct tg...
780 byte By
Lazze at 2007-11-25 11:48:37
HelloI've recently moved a large project written in mainly C using Borland C++ 5.0 to another server, but when I try to compile I'm getting a lot of errors when tlink32 is running.The errors looks like:Error: Unresolved external '__ErrorMessage' referenced from module c0ntd.ASMEr...
Heya,Im using Winsock to recieve a string.. eg "Hello, World". As usual with winsock, i recieve it in a character array. What I wanna do, im making some kinda, something, which stores each word in a sperate thing. So, I guess this is string seperation..? Anyone shed some light?Sorry if this should b...
1075 byte By
prads at 2007-11-25 11:48:11
Hello,the following code doesnot return the corect values to the main function. However it prints the correct values within the function. Also the same when written in C works absolutely fine. Pls tell me where im going wrong and correct me. U can run it and check!ThanksPrads<code>#include <...
961 byte By
kenrus at 2007-11-25 11:48:01
I am having difficulty understanding how this situation will work.using std::string;//Prototypesstring MixCase(string& sString);void UseRef (string& sRefString);void UseCopy(string sCopyString);void main(int argc, char** argv){ string MyString; UseRef (MixCase(MyString)); UseC...
I was reading on pointers in a PDF I found on the tubes, and I noticed that a code example uses pointers to do a pass by reference.In C++ I last spring, when we wanted to pass a value by reference, we used int& someVar; for the variable in the parameter. The PDF uses int* someVar; instead. As far...
i am trying to calculate the average value of a 2d array that is 400x400 elements big. for some reason i am getting a different negative value every time. here is my code i have for the program so far. the data file is too big to attach. hopefully its not necessary. the max value in the data file is...
2681 byte By
cuba06 at 2007-11-25 11:47:41
I was instructed to create a program that computes the efficiency of an engine based on the specific heat ratio of a gas, for different compression ratios.We were told that we need sub-functions that do a bunch of different things, and then to link them into the main function. I've got what I...
630 byte By
C#er at 2007-11-25 11:47:38
I'm a C++ programmer about 2 years. My question is not about to solve a specific trouble. I'm being scared with the crescent growing of languages like C# and Java. What I would like to know of anyone is the following: These languages will definitely substitute C++? In any kind of market. I...
1175 byte By
dude_1967 at 2007-11-25 11:47:36
Hi,I'm back here after a bit of a pause.Got a real simple question pertaining to the exact specification of the behavior of bool in the C++ language.What is the proper method to assign a boolean value (data type bool) to the result of a comparison?I know that in C the result of a comparison is...
Guys I need your help, (again)<br/>I'm getting different answers to the question:<br/>Can we generate a C++ source code from the binary file? <br/>Some say it's impossible!!! some say I can.<br/>Can some clear it up for me please.<br/>Many thanks...
736 byte By
Sivakk at 2007-11-25 11:47:20
I want to have a program that outputs numbered files using a 4 digit scheme. So file #1 would be file0001. It must be 4 digits.I was thinking of doing something like having a counter of where you're at, converting the digit to a string and putting the appropriate amount of 0's in front o...
82 byte By
l00p1n6 at 2007-11-25 11:47:10
Is there any use for methods returning constant built in types?<br/>Thank you
I have a character array a[100]. now when the user gives the input --> <br/>Hello World . I want to get the length of the string Hello World which has to be 11 including the space.the answer i get is 5. how do i get the answer 11?
Hey,I am having difficulties writing a recursive method that displays all permutations of a list. It has to be recursive and not iterative and it has to take in a list<int>. I can write the method using a string parameter or making it iterative, but I can't for the life of me (i've...
2197 byte By
jrice528 at 2007-11-25 11:46:45
just need help with the "Is there another contestant" y/nto loop the program back to the begining if i pressed y and to exit if i hit n#include "Stat.h"#include <iostream>using namespace std;void getJudgeData(int &);double calcScore(Stat s);int main(){ Stat s; int score1 = 0, score2...
The following code below takes an array of string items (tokens) and searches for the lexographically largest, well it should anyways. The problem is that the program seems to reach the base case just fine, hand back and do the first comparison than BOOM. The stack dumps. No warnings or anything. An...
Sorry guys for my n00by question but what exactly does return do? If I'm writing a fuction and it returns a variable named x what exactly happens to the value of x?
Hi,I was hoping someone could help me with a problem I've been having. I can't seem to get 64 bit apps in visual studio 2005 (standard, academic on win xp pro x64, 6GB RAM) to allocate more that 2GB of RAM. I've written a test app:int main(){ float test[1024][1024][1024]; return 1...
4446 byte By
Kit42 at 2007-11-25 11:46:28
This is my first post. I am a computer science student and have gotten to the point where my homework is rather hard my by standards:In part of my program I am supposed to write a copy method that copies a linked list recursively. I may or may not have figured out how to do that. My current try give...
2735 byte By
Omega234 at 2007-11-25 11:46:25
I've been working on a program that tells you all the first and second possible digits for a combination lock, if you give it the third digit (using information I found online, but that's not important). It uses a few arrays that hold the possible combinations, then based on the remainder...
413 byte By
Rooting at 2007-11-25 11:46:24
hi friends!!..if i have 2 number, and 1 imput..i would to test if the imput is a multiple of the 2 number..if i can as this:float number;float a = 2.55;float b = 20;cin >> number; if ( number%a==0 || number%b ==0 ){ cout << "number is divisible"; }show me errors..how...
2112 byte By
jrice528 at 2007-11-25 11:46:20
been working on this for a long time and i really need some help.here is the assignment...Design and implement a function void getJudgeData() that asks the user for a judge's score, stores it in a reference parameter variable, and validates it. This function should be called by your function ma...
hey guys!i have the following problem where i can't find a suitable solution for.i'd like to write a small precompiler that knows basic c++ language components like (for, while, do while, switch and if-else if-else). what i try to do is...for example i make an annotiation in a c++ source c...
591 byte By
yurec at 2007-11-25 11:46:14
Hi.I start learning boost.Here is very simple code I can't compile.typedef std::vector<LPCWSTR> type; type test; test[0] = (_T("1")); test[1] = (_T("2")); test[2] = (_T("3")); std::for_each(test.begin(),test.end(), OutputDebugString(_1));Got compilation error : ------------------erro...
In this program I am working on, I want to save numbers. An example is if I input a number 20 I want the program to save the number 20 so that I can add a different number to it the next time I run the program. I am saving the numbers in a .txt file, maybe I could read them in with that file? I just...
269 byte By
kirankn at 2007-11-25 11:45:44
I have a complex class CComplex. <br/>I am able to do the following operation using overloading.<br/>CComplex A;<br/>CComplex B;<br/>B = A * 2;<br/>But, I am unable to figure out how to do B = 2 * A;<br/>Is this possible?<br/>Regards,<br/>Kiran
149 byte By
w1985 at 2007-11-25 11:45:39
How can I restrict random generated values to certain numbers, for example if i wanted to the random function to only output 1 and 4?<br/>Thanks
280 byte By
George2 at 2007-11-25 11:45:38
Hello everyone,<br/>I remembered delete[] is implemented through operator overloading, but I am not quite clear.<br/>Could anyone recommend some links about how delete[] is implemented so that I can learn and refresh my memory? :-)<br/>thanks in advance,<br/>George
412 byte By
ikcha at 2007-11-25 11:45:28
any memory leak?.void abc(char **c){ *c = (char*)new char[10]; strcpy(*c, "hello!");}int main(void){ char *c; abc(&c); std::cout << c << std::endl; if (c != NULL) { delete [] c; c = NULL; }...