49,761 Topics
| |
[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 | |
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. | |
Hey does anyone know how can we detect virus using c++. | |
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 >+ … | |
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 … | |
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, … | |
Nevermind, simple solution | |
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 … | |
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] | |
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 … | |
How do I compare what is in one array with what is in another array? | |
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 … | |
[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 … | |
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 … | |
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! … | |
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] = … | |
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 … | |
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. | |
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 == … | |
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 … | |
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) … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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 … | |
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 … |
The End.