49,761 Topics

Member Avatar for
Member Avatar for reolynda

[CODE]#include <iostream> using namespace std; int main() { int i,j; float a[10][10]; for (i=0; i<10; i++) { for (j=0; j<10; j++) { a[i][j]=0.2; a[i][j]=a[i][j]-0.2; cout<<a[i][j]<<"\n"; } } } [/CODE] //// why is the output not exactly 0.00 ??? how do i make it output 0.00

Member Avatar for reolynda
0
96
Member Avatar for Haranadh

Hi Can I use the this object inside the constructure of a C++ Class? please share if any one have idea what are the issues we may fall into.

Member Avatar for Haranadh
0
77
Member Avatar for gameon
Member Avatar for ota1it1iuss

Okay, the first project was to build a calculator that functioned as follows: ----------Using the example functions about, write a calculator program. Allow for the user to enter a simple math functions to evaluate: (Note: the '>' designates user input for cin) >5 >+ >7 >= result:12 or: >5 >+ …

Member Avatar for ota1it1iuss
0
201
Member Avatar for ana_1234

I have an assignment in class I'm and almost done but I need help with one part. Within each subject in the output file, list the students in alphabetic order, sorted by last name. Do not change the given case (upper/lower case) of the names that were read from the …

Member Avatar for ana_1234
0
2K
Member Avatar for escortcosworth

Hey guys, iam assigned a program that has to read in 3 values (sides of triangles) at a time and find the area. The values have to be read from a file, they are in a loop as there can be as many sets of triangles as the user wishes, …

Member Avatar for escortcosworth
0
88
Member Avatar for rObOtcOmpute
Member Avatar for rObOtcOmpute

I posted a thread a bit earlier about a simple error, but this is more of my main issue. I have a struct: [CODE=C++] struct Inventory { string ItemName; int ItemQty; float ItemPrice; }; [/CODE] with the intention of creating an array for storing an inventory array. I can't seem …

Member Avatar for rObOtcOmpute
0
221
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
111
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
150
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
164
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
689
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
285
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
400
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
133
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
232
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
86
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
117
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
115
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
219

The End.