49,755 Topics

Member Avatar for
Member Avatar for literal

Can somebody on a beginners level explain the code below [CODE] int i, j; for(i=2; i<16; i++) { for(j=2; j<=(i/j); j++) //confusion 1 if(!(i%j)) break ; if(j>(i/j)) cout<<i<<" / "<<j<<endl;//confusion 2 } [/CODE]

Member Avatar for literal
0
110
Member Avatar for Kusanagi03

After searching through this forum and other forums relating to C++ and Dynamic Memory; I would like to know the indepth reason on why do you have to declare a dynamic memory allocation in either a Class or in a function for the program to compile? e.g. [code=c++] //place a …

Member Avatar for sfuo
0
149
Member Avatar for coolmel55
Member Avatar for arkoenig
0
302
Member Avatar for qqwushi12345

Solving the greatest common divisor using C++ and the Euclid method Below is my code: #include "stdafx.h" #include "genlib.h" #include "simpio.h" #include "math.h" int _tmain(int argc, _TCHAR* argv[]) { int num1,num2,rem; printf("Enter 1st number: "); num1=GetInteger(); printf("Enter 2nd number: "); num2=GetInteger(); rem=num1%num2; ;if(rem==0) { printf("The GCD of %d and %d …

Member Avatar for daviddoria
0
163
Member Avatar for sabareesh

[CODE]void String::operator+=( String &pData) { int nLen = 0; // for store length of string // check string is null or not if(pData.m_pText != NULL) { // length of string nLen = (int) strlen(pData.m_pText); } // Total string length int nTotLen = m_nLength + nLen; //object of string class String …

Member Avatar for sabareesh
0
136
Member Avatar for nolife

hello every body i just join us so ..... i have a little problem with a variant , i call in first step : "variantClear(&bbvariant)" and after when i call a member of my bbvariant " _bstr_t (bbvariant.bstrVal).length() " is not equal to 0 , so i want to someone …

Member Avatar for nolife
0
688
Member Avatar for lightningfire

I'm trying to learn c++ and am trying to use classes. I'm doing something wrong but can't figure this out. Here's the code: [CODE=c] #include <iostream> using namespace std; class dead { public: void dieNow() { cout<<"You just died!"<<endl; cin.get(); } }; class alive { public: void youLive() { cout<<"Whew! …

Member Avatar for lightningfire
0
157
Member Avatar for atch

Is it possible to have pointers to references in c++? I'm asking because in my simple code: [code=c++] #include "stdafx.h" #include "Nunu.h" int _tmain(int argc, _TCHAR* argv[]) { Nunu* p = new Nunu[5]; Nunu a("a"); Nunu b("b"); Nunu c("c"); p[0] = a; //critical line/s p[1] = b; // p[2] = …

Member Avatar for atch
-1
284
Member Avatar for Annettest

Hi everyone: I need to find out about compile options in Xcode (I'm an Xcode and C++ newbie). The default compiler for OS 10.6 and XCode version 3.2.2 is apparently LLVM 2.0. Is this related to g++? Also, are there other compilers available within XCode? If so, how would I …

0
98
Member Avatar for aaronmk2

I want to center this. [CODE]cout<<a<<" "<<"+ x = "<<b<<endl;[/CODE] a and b are both int. How would I go about this. Most of the information I found on the web is about centering strings, I tried the code but did not have any success.

Member Avatar for Nick Evan
0
166
Member Avatar for Weichen

I have input stream problem where my Console::ReadLine() command gets "eaten" when I try to loop my program back to start. Here is the code [code=c] #include "stdafx.h" using namespace System; int factorization(); int main(array<System::String ^> ^args) { int terminate; do{ terminate = factorization(); }while(terminate == 'y' || terminate == …

Member Avatar for Weichen
0
379
Member Avatar for PixelExchange

Hello everyone. Working with winsock, I have successfully been able to connect a client application to a server application that is running on the SAME computer. My problem is, I cannot, for the life of me, get a client application to "connect" to a server application that is running on …

Member Avatar for Aranarth
0
132
Member Avatar for dchunt

I've wanted to write a program to read the extended characters from a file. [ICODE] #include <iostream> #include <fstream> using namespace std; int main() { char a,ch[50]; long l, m, k; ifstream infile; infile.open("as6.txt"); l = infile.tellg(); infile.seekg(0, ios::end); m = infile.tellg(); k = (m - l); infile.seekg(0, ios::beg); while(infile!=0) …

Member Avatar for kadams
0
132
Member Avatar for ylin333

How do you access a database from a C++ or Windows API program? :-/ I would like to be able to get data from a database as strings or something. I want to use a database so that it is easily changed from MS Access or something similar. Thanks in …

Member Avatar for ylin333
0
231
Member Avatar for Ryan61343

i have a couple of should be simple linked list questions one of which is how to make it insert in a sorted fashion i have a way i think should work but it doesnt i can post the code if needed. also i have to delete the last n …

Member Avatar for Ancient Dragon
0
81
Member Avatar for Vexx

Hello everyone, I am having some trouble with a program I'm writing and I can't figure out for the life of me what is going wrong. I'll post the code below but first I will point out the problems I'm having. (Both problems are highlighted in my source code with …

Member Avatar for Vexx
0
109
Member Avatar for punchinello

Do any of you veterens have expirence with displaying and controling a 3d model with c++ programming code and maybe spicifically with vb6.0? Any literature on the subject you would like to recommend or any key words I could use with searching? How do I go about learning it? Thank …

Member Avatar for punchinello
0
1K
Member Avatar for rokz84

okay.. i'm really stuck on this program assignment i have to add two arrays (20 digits long) than sum the two. what i have done so far is (or at least attempted) is putting the digits into a temporary array than moving them into one of the arrays i want …

Member Avatar for vocater
0
116
Member Avatar for rObOtcOmpute

I'm supposed to use a 'top-down' programming style (which is my enemy) for a simple game of Cootie, and I am very new to C++ so there will be errors abound in my program, I'm just working on getting past one error thus far: [CODE=C++]void ApplyRoll(int Roll, int Body, int …

Member Avatar for rObOtcOmpute
0
3K
Member Avatar for okwy

Good day all, I have a date string format say like "2010-03-01" and I want to get the "tm_wday" equivalent of it say like Monday, Tuesday ... Could someone give me a hint on how to achieve this in c. Thank you.

Member Avatar for Ancient Dragon
0
221
Member Avatar for Rachel Ross

This problem is related to an unsolved problem in game theory... Consider a blind cat and mouse that live on a (unit) circle. They start off in random positions then each choose a speed and start running in a random direction. On average how far will the cat run before …

Member Avatar for Aranarth
0
114
Member Avatar for lafayettejohnso

Hi Iam new to c++ programing and I have this project where I must write a program that takes in data from the employee.dat. I have the program started but now Iam stuck any help would be greatly appreciated. heres my instructions. • Note there are only 4 employees in …

Member Avatar for daviddoria
0
217
Member Avatar for Jennifer84

Hello I wonder if it is possible center align a linklabel in a Panel ? I cant find any property for this in the Panel. Thank you

Member Avatar for jonsca
0
95
Member Avatar for wyssen

Hi, I have a wired problem. I try to build a argv array which will be passed to ssh command. The following line works perfectly: [CODE]argv[n++] = "64.106.11.123";[/CODE] But when I try to get the IP address out of a string which contains it, it will add me a line …

Member Avatar for wyssen
0
279
Member Avatar for wander36

Hey, I'm trying to create a program that displays a map and allows the user to put coordinates on the map and enter what the coordinate is. I want the user part to be in a console window, but I want the map to be displayed using SDL. I can't …

0
31
Member Avatar for Twinzen

I'm having trouble with using a multiset of my own data structure. It seems to complain about my comparison (less than) function when I try to iterate, but it works at some level because I can insert() stuff and call functions from the first member of the multiset. If anyone …

Member Avatar for Twinzen
0
139
Member Avatar for ironmancpp

Hi I am learning c++ at school. I am supposed to submit a project this year end. I would like to create an offline mail server using c++; something in which you can create an account and read & send messages to other existing accounts in the same computer. Once …

Member Avatar for Ancient Dragon
0
202
Member Avatar for Anex

I am working on a program which would really become easier to write if I can use character variables as an index to an array.. for eg. if char_var is a character variable say initialized to 'a'(ascii decimal value = 97), then array1[char_var] should refer to array1[97] element. I wrote …

Member Avatar for Ancient Dragon
0
8K
Member Avatar for Nathaniel10

Hi!, I am doing the exercises in Stroustrup's book, Programming: Principles and Practice Using C++. The 6th chapter uses a simple calculator to demonstrate Tokens and grammars. I realize that there are other calculator questions in the forum, but I did not find one that dealt directly with mine. An …

0
38
Member Avatar for Kanoisa

Hi, I think im trying to break c++ again in making it do something it does not want to do. Basically i have a logging class im making which simply takes a string stream and pumps it into a file. But i want 2 different versions one that trys to …

Member Avatar for Kanoisa
0
188

The End.