51,593 Topics

Member Avatar for
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
113
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
104
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
149
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
172
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
145
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
102
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
105
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
250
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
95
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
125
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
322
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
148
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
160
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
118
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
143
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
153
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
137
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
95
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
156
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
141
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
70
Member Avatar for suutukil

Please help me with my assignment in c++! Write a program that will input 10 numbers and display the sum in a ASCENDING ORDER. please help me i really need this badly...

Member Avatar for suutukil
0
623
Member Avatar for jdam7459

I am having trouble getting Windows to open the file "results1.txt" in the directory "Result Sets". When I run it I get the error: "results1.txt" is not a recognized as an internal or external command, operable program or batch file. But when I check to see if the file is …

Member Avatar for marco93
0
132
Member Avatar for serdengil

Hey guys, I do have a main function and need to write the class. I just need to where should I start. I am a new in C++ but the prof. asked us to write the class code of this calculator. He already gave the main function and the purpose …

Member Avatar for Lerner
0
122
Member Avatar for DarthPJB

I return with another perplexing issue that I just can't figure out, a generic and unhelpful"std::bad_alloc at memory location" error. Before I get to the code, some background... Having finished my uber-awesome 2D engine (thanks entirely to you guys) I decided it was time to break open the can of …

Member Avatar for DarthPJB
0
326
Member Avatar for ticktock

Hey all, I am fairly new with C++ and I registered here to ask for suggestions on how I can create my project. I proposed to my professor that I will create a scientific calculator with "additional functions". By additional functions I mean like a SC with that can solve …

Member Avatar for ticktock
0
142
Member Avatar for hurbano

Im having trouble fixing this error on my program. Any help would be greatly apprecitated. [code=c++] #include <iostream> using namespace std; int main () { char choice; cout<<" Is it after 12 noon? (y/n)" <<endl; cin>>choice; if (choice == 'y') cout<<" Good afternoon, world!"<<endl; else if (choice == 'n') cout<<" …

Member Avatar for DarthPJB
0
85
Member Avatar for Talguy

I am not asking anyone to design the parser for me, this is something i would like to do myself so that I can learn how to do it in the future. I am entering into a IEEE 24 hour programming contest with two other people. I have the problems …

0
65
Member Avatar for phillipeharris

I am confused as to why I am getting this on GCC. I have all the flies in the same directory, I have have closed the compiler and reopened it and I am still get this error. I am getting oters too but I am sure that can be fixed …

Member Avatar for ilikelampard
0
159
Member Avatar for pfkdesign

Hi! I am working in a project on window base C sharp and i successfully create resizable, moveable multiple rectangles by mouse dragging on a PictureBox but i cant distinguish between them! ex i want to delete the selected rectangle (first select then click on the delete button) . " …

0
38
Member Avatar for Elektrikz

Hello guys. After some time searching around the forums for a thread about an e-book for crash course from C++ to Java and no luck I decided to post a thread about it. So my question is,does anyone has or knows such book? Thanks in advance.

Member Avatar for tux4life
0
283
Member Avatar for lotrsimp12345

#include <iostream> #include <stdio.h> #include <fstream> #include <string> using namespace std; int main() { int number_Of_Lines_To_Print_From_End=0; char file_name[20]; streampos length; cout<<"enter file name that needs to be opened\n"; cin>>file_name; cout<<"enter number of lines to print from end of file\n"; cin>>number_Of_Lines_To_Print_From_End; fstream file; file.open(file_name, ios::out ); if(file.is_open()) { cout<<"the file opened\n"; …

Member Avatar for lotrsimp12345
0
134
Member Avatar for swolll

Here is my code: [ICODE]#include <iostream> #include <string> #include <iomanip> #include <cmath> using namespace std; int main() { const double e = 2.71828; double t, f, n, B, VoltageGain; cout << "Please enter the time in hours the culture has been refrigerated: "; cin >> t; cout << endl; while …

Member Avatar for swolll
1
627
Member Avatar for lotrsimp12345

In unix if you create and open a file by using 9 digits numbers in the open function it seems to work but in C++ you only don't have a parameter to do that rather you have ios_base. Just wondering if there are owner,group and world settings that can be …

Member Avatar for lotrsimp12345
0
114
Member Avatar for Samyx

Hi everyone. I want to read a file and store each word in an array. I also want to know how many words there are in the file. After I do this, I want to reverse the words from two different files and see if they are anagrams. Here is …

Member Avatar for VernonDozier
0
174
Member Avatar for hao001

[ICODE] #include <iostream> #include <algorithm> #include <string> using namespace std; struct employees { int em_id; string em_name; string position; string gender; }; void read(employees record[], int max_1); bool IDsort(const employees &a, const employees &b) { return(a.em_id < b.em_id); } char Namesort(const employees&a, const employees &b) { return(a.em_name < b.em_name); } …

Member Avatar for VernonDozier
0
152
Member Avatar for lotrsimp12345

O_RWDR opens a file for read and write and pmode allows you to specify permission for each of the users? WHAT DOES IT MEAN BY WHAT PMODES AND O_RDWR ARE AVALABLE ON YOUR SYSTEM? CONSIDERING I AM USING VISTA I HAVE NO IDEA. I HAVE THE ABILITY TO READ AND …

Member Avatar for lotrsimp12345
0
537
Member Avatar for serkan sendur

guys i need an error-free way of keeping name value pairs in a regular c# string. i am quite busy, i dont think i am able to come up with the best algorithm now. what i want is two methods one to add a name-value pair to the string, the …

Member Avatar for kvprajapati
1
1K
Member Avatar for Jennifer84

I have a little special question about the for loop. Normally you could do the count as I have declared with a count from 0 - 10. What I do inside the loop is to identify many scenarios if the count should start from 0 - 10 or vice versa …

Member Avatar for puluke
0
128
Member Avatar for fallopiano

Hi all. I recently wrote a python program that takes a screenshot of the current active window. After taking that screenshot, it saves it as a bmp (using PIL), and then goes thru each pixel, looking for a certain color. If it finds that color, it moves the mouse to …

Member Avatar for fallopiano
0
129
Member Avatar for gilpin

Hello everybody, I want to create a program that removes the first line from a text (csv) file (which is a header). I used this code: [CODE] string deleteline = "Name, ID, D.O.B, etc., etc."; //contains the Header information to be removed string line; ifstream sup; sup.open("DOWNLOADED_DATA.csv"); ofstream temp; temp.open("temp.csv"); …

Member Avatar for gilpin
0
173
Member Avatar for ellimist14

I really need help with this guys. This compiles and runs but does not give me the right output. tfile.data: Seth 19 1.7 Austin 20 1.8 Michael 21 1.9 [code]#include <iostream> #include <fstream> using namespace std; int main() { ifstream fin; fin.open ("tfile.data"); if (fin.fail()) { cout <<"ERROR"; exit(1); } …

Member Avatar for NathanOliver
0
89
Member Avatar for lebronjames

Hi yall, So what my code is supposed to do is basically count the number of paranthesis that the user enters and hit me back with the result. The code below works perfectly when there are no white spaces in the user's input. But when white spaces are present, It …

Member Avatar for lebronjames
0
83
Member Avatar for willywonka

Hi all, I am a first year student at the university of South Africa. I am doing my degree via correspondence, thus no lectures. I am working through the prescribed book as best i can but they still assume a little bit of fore knowledge of programming which i don't …

Member Avatar for willywonka
0
138
Member Avatar for mz_rigel

I need help with my homework assignment for school. I was able to get everything to work fine when I just put everything in int main() without using functions but when I tried to separate everything into functions the program is not running correctly and although I don't get an …

Member Avatar for KonkaNok
0
121
Member Avatar for syd919

hello I am trying to desing a simple rss feed reader, I am using curl to load the source code of a webpage and store it in a string and create an xml file, I then use xerces-c to parse the xml file, this works well but i need to …

0
64
Member Avatar for syd919

hello I am trying to design an rss feed reader using xerces-c and im using dom parsing, I am new to this side of programming and everything I know so far is self taught. I can read an xml document that is in my computer but I can't access external …

Member Avatar for syd919
0
124
Member Avatar for daviddoria

I made 2 classes, Point and Point3D: Point.h: [code] #ifndef POINT_H #define POINT_H #include <iostream> template <typename T> class Point { protected: T X,Y,Z; public: Point(const T x, const T y, const T z) : X(x), Y(y), Z(z) {} T getX() {return X;}; T getY() {return Y;}; T getZ() {return …

Member Avatar for DdoubleD
0
540

The End.