49,761 Topics

Member Avatar for
Member Avatar for lotrsimp12345
Member Avatar for blahbla

hi i need some help with adding a bunch of random numbers. i dont understand how to add them all. heres the code: [CODE]#include <iostream> #include <cmath> using namespace std; int main () { int i,x; srand (time (NULL)); for (i=1; i<=10; i++){ x=rand()%10+1; cout<<x<<endl; } system ("pause"); return 0; …

Member Avatar for blahbla
1
157
Member Avatar for RedWinger

Hello everyone, I'm having a bit of an issue here. I'm doing a Knight's Tour program for class, and thought I just about had it until this problem popped up. While I was writing my code, I had some simple cout test statements after some of the function calls just …

Member Avatar for Salem
0
98
Member Avatar for daviddoria

I have a function like this: [code] bool MyFunction(dist) { if(dist < 1.2) { std::cout << "Passed test!" << std::endl; return true; } else { std::cout << "Failed test!" << std::endl; return false; } std::cout << std::endl; } [/code] gcc tells me "warning- control reaches end of non-void function". However, …

Member Avatar for StuXYZ
0
273
Member Avatar for Mafia619

i am tryin to make a c++ program to play tic tac toe.........there are some errors hope u guys can help me out......... [CODE]#include<iostream.h> #include<conio.h> #include<stdlib.h> char matrix[3][3]; void cou(void); int main() { int m,n; char ch='y'; while(ch=='Y'||ch=='y') { for(m=0;m<3;m++) { for(n=0;n<3;n++) { matrix[m][n]='\0'; int i,j,sum=0; while(sum<10) { if(sum==0) { …

Member Avatar for sfuo
0
276
Member Avatar for johndoe444

The following is the randomized Binary search tree insertion algorithm mentioned in sedgewick's book. "This function makes a randomized decision whether to use the root insertion method of Program 12.13 or the standard insertion method of Program 12.8. In a random BST, each of the nodes is at the root …

Member Avatar for johndoe444
0
140
Member Avatar for Supercharger

i need help with this C++ array excercise.... it seem quite simple but im not sure what code i need to put where. help is greatly appreciated... Excerise:: [url]http://www.lhs.logan.k12.ut.us/~rweeks/cp1/array.htm[/url]

Member Avatar for dgr231
0
154
Member Avatar for Warcat

Ok, this is actually very simple I just can't figure it out... first of all I'm a complete beginner in C++ and I was given this assignment to do a dice game (yes assignment, please note that I'm not looking for a code, just help on how to do it). …

Member Avatar for sfuo
0
109
Member Avatar for Mafia619

i am tryin to make a c++ program to play tic tac toe.........there are some errors hope u guys can help me out......... #include<iostream.h> #include<conio.h> #include<stdlib.h> char matrix[3][3]; void cou(void); int main() { int m,n; char ch='y'; while(ch=='Y'||ch=='y') { for(m=0;m<3;m++) { for(n=0;n<3;n++) { matrix[m][n]='\0'; int i,j,sum=0; while(sum<10) { if(sum==0) { …

Member Avatar for Salem
0
100
Member Avatar for GooeyG

The assignment is to design a savings account program. The program has to include: a constructor that accepts an argument of type double and uses it to set savingsBalance. If the value is passed is less than 0, set savingsBalance to 0. Add a public member function named calaculateMonthlyInterest that …

Member Avatar for GooeyG
0
145
Member Avatar for shen747

Hi all, I'm having trouble compiling a C++ project,which was originally written using the VC++, in Dev-C++. The problem is identifying the compiler errors that are incurred by the Min-Gw compiler(the default compiler that is shipped with Dev-C++) I've currently have converted the project(which is an opensource example of JNI) …

Member Avatar for Salem
0
170
Member Avatar for privs

Hi folks. I inherited an FTP program from a colleague that left the team so i have to do C++ programming now. The problem is that the FTP program throws up winsock errors. the FTP skips these errors but after a while it terminates the program. So I writing another …

Member Avatar for VernonDozier
0
141
Member Avatar for rajesh.hck

Hey guys, I am new to C++ coding. Can anyone help me and tell me how can I get a C++ Compiler free for study purpose.

Member Avatar for dgr231
0
99
Member Avatar for samm22

If I have a vector v={1,2,4,6,8} and I find my maximum element of this vector using this: " vector<int>::iterator iter_max = max_element(v.begin(), v.end()); cout<<"Largest element is "<< *iter_max; " which works fine. But I need to know the position of this max element. Is it second, third or fourth in …

Member Avatar for JasonHippy
0
100
Member Avatar for NinjaLink

Hello all. I am currently working on creating a program of a Checking Account and Savings Account. I am using my input file for deposits and withdraws. However, for my deposit and withdraw functions, I am unsure what to put in it. For those functions, am I suppose to read …

Member Avatar for NinjaLink
0
247
Member Avatar for shilpa_B

hi everyone,i Have posted a code where i have created a structure in which i am defining bitfields. If suppose for the object testvar[2][K] i wanna assign {1,1,1},{1,0,1},should i assign them individually or can i assign at once like testvar[1][K].testa=7; //for {1,1,1} testvar[2][k].testa=5;//for{1.0,1} please help me,[code]#include<conio.h> #include<string.h> #include<iostream.h> #define K …

Member Avatar for shilpa_B
0
93
Member Avatar for gretty

Hello [B]Can you tell me why my for loop below doesn't show all the elements contained in a stack (stacks size = 3). [/B] It only shows the top 2 elements when it shoudl show all 3? Also another question, is there a way to show the contents of a …

Member Avatar for mrnutty
0
123
Member Avatar for Lukezzz

I try to write to Isolated Storage but get this exception. I wonder what I can be missing ? [I]An unhandled exception of type 'System.IO.IsolatedStorage.IsolatedStorageException' occurred in mscorlib.dll Additional information: Unable to determine application identity of the caller.[/I] [code] using namespace System::IO::IsolatedStorage; IsolatedStorageFile^ abc = IsolatedStorageFile::GetUserStoreForApplication(); String^ Testfile= "Test57.txt"; IsolatedStorageFileStream^ …

Member Avatar for kvprajapati
0
320
Member Avatar for heroic

can i have a sample code of a c++ program that reads in a jpeg file, and with comments please, i am trying to learn image processing using jpeg file formats... i would love to have advanced codes too, if any one of you can provide me with them. i …

Member Avatar for Talguy
0
140
Member Avatar for suutukil

please do help me the program goes like this; #include<iostream.h> void main() { int x; int no[10]; cout<<"input 10 numbers"<<endl; for(x=0;x<=9;x++) cin>>no[x]; for(x=0;x<=9;x++) cout<<no[x]<<endl; } but i have to get the sum 0f the 10 numbers in ascending order this the outtput example: 1+1=2 2+2=4 3+3=6 5+5=10 4+4=8 i have …

Member Avatar for wheel
0
157
Member Avatar for rstep21

I have a level 2 programming class i have to take for my major, even though i'm on the IT track and not programming. I struggle alot with programming and was looking to get pointed in the right direction. Below is the directions for my assignment but i honestly have …

Member Avatar for wheel
0
115
Member Avatar for roberto usu

I know this is a kind of broad question, but I have been having a hard time in general knowing when to put what call parameters into what functions. Does anybody have any good tips on when to know when to use a void function verses a bool or int …

Member Avatar for roberto usu
0
116
Member Avatar for kz07

well, this is my code: [CODE] while(!isdigit(c) || num.length() < 4){ cout << "Enter your four digit pin: "; cin >> num; for(i = 0;i < num.length(); i++){ c = num.at(i); if (isdigit(c)){ pin[i] = atoi(num.substr(i, 1).c_str()); } } if(!isdigit(c) || num.length() < 4){ cout << "Invalid Pin." << endl; …

Member Avatar for kz07
0
1K
Member Avatar for killerqb

I'm having a problem with creating my own stack class and implementing it in a postfix calculator program I made. I was trying to make the stack.h file, but it keeps telling me stack is not a template [CODE]#ifndef STACK_H #define STACK_H #include <iostream> using namespace std; template <typename T> …

Member Avatar for killerqb
0
152
Member Avatar for rogerfsg

I have the follow code: In this code i want initialized an object of cube! but when i did this, I initialized an array of matrix_type and in each object of the array matrix_type i initialized an object of array_type! BUT, if i try this with a matrix and with …

Member Avatar for rogerfsg
0
134
Member Avatar for saurabhsaki

# Write a program to download a website from a given URL. It must download all the pages from that website. It should take the depth of retrieval from the user input. All the files/pages must be stored in a folder. # Write a small record management application for a …

Member Avatar for William Hemsworth
0
144
Member Avatar for Lukezzz

I have filled a List like below wich some strings. I wonder if the List has any property where you in an easy way can remove duplicates. Else I wonder how this can be done ? [code] List<String> GetData = new List<String>(); GetData.Add("one"); GetData.Add("two"); GetData.Add("one"); GetData.Add("three"); [/code]

Member Avatar for serkan sendur
0
93
Member Avatar for suutukil

please do help me the program goes like this; #include<iostream.h> void main() { int x; int no[10]; cout<<"input 10 numbers"<<endl; for(x=0;x<=9;x++) cin>>no[x]; for(x=0;x<=9;x++) cout<<no[x]<<endl; } but i have to get the sum 0f the 10 numbers in ascending order this the outtput example: 1+1=2 2+2=4 3+3=6 5+5=10 4+4=8 i have …

Member Avatar for mrnutty
-1
152
Member Avatar for JungWoo

hi all, i am done with my project for lexeme but i only worked on cpp, i wonder that can i make my header file based on my cpp file? thank you this is my code [CODE]#include <iostream> #include <fstream> #include <string> using namespace std; int main () { char …

Member Avatar for Dave Sinkula
0
138
Member Avatar for dpreznik

Maybe somebody could please help me understand why I fail to write stl's map of vectors into a file using CFile::Write()? typedef std::vector<CLocation> LocationArray; typedef std::map<int, LocationArray > MapLocationArray; ... [CODE] int iSize = sizeof(m_mapLocations); cf->Write(&iSize, sizeof(iSize)); cf->Write(&m_mapLocations, iSize); [/CODE] When I am writing, the m_mapLocations contains valid data. But …

0
68

The End.