51,593 Topics

Member Avatar for
Member Avatar for ricnyx

#include <iostream> #include <fstream> using namespace std; int main( ) { ifstream fin; ofstream fout; fin.open("income.dat"); if (fin.fail( )) { cout << "Input file opening failed.\n"; exit(1); } fout.open("total.dat"); if (fout.fail( )) { cout << "Output file opening failed.\n"; exit(1); } double next, sum = 0; int count = 0; …

Member Avatar for ricnyx
0
133
Member Avatar for Chaster

Hi everyone, I created a quite complex model in 3d studio max, then I converted it to an .obj file. In 3dsm I put the textures, everything looks fine. Then, when I load the object file it's gray again. I tried the following: - read the texture file (BMP) - …

0
62
Member Avatar for johny112

Im trying to write the programme for the following question, and im really struggliing. I will be reaaly thankful if someone can give me some tips or a programme for this. I would also like to point that im new to programming and this website so please give me some …

Member Avatar for johny112
0
103
Member Avatar for misdongard

hey ppl.. can someone please help? I am aware that u said u have to attempt the question urself but my teacher is an asshole and doesnt know how to teach very well. and he dropped a big question on us and none of us know how to do it, …

Member Avatar for Lerner
0
77
Member Avatar for java.cream

Hi all, [CODE]1: #include <iostream.h> 2: 3: int main() 4: { 5: cout << "Hello World!" << endl; 6: return 0; 7: }[/CODE] In the above code does the line 6 (return 0), required by the operating system,that means tells the operating system a program finish? If true, what the …

Member Avatar for Ancient Dragon
0
108
Member Avatar for nicz888

[code=c++] #include <cstdlib> #include <ctime> #include <iostream> using namespace std; // prototype and name space declaration bool testAnswer(int, int, int); void correctOutput(); void incorrectOutput(); bool mathTest(); //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ int main() { if (mathTest()) { !(mathTest()); mathTest(); } } bool mathTest() //main function { srand((unsigned)time(0)); // random number generator int …

Member Avatar for Ancient Dragon
0
130
Member Avatar for tonyaim83

Hi I m using the boost graphml.cpp file to extract information from a graphml file. But when trying to compile this i m getting compilation error `C:\boost_1_34_1\libs\graph\src\graphml.cpp expected } at end of input` What can be the reason for this. I checked it out the all combination of braces are …

Member Avatar for tonyaim83
-1
166
Member Avatar for rajsharma_85

hi guys, I am making a program in which I have to enter start date and time and stop date and time in format like 01:05:07 15:26:57 I know that i need to use <time.h> function for that but i don't know how can i calculate the difference between time. …

Member Avatar for Salem
0
145
Member Avatar for edek

Hi all! I need to create regex that matches everything before some specified (whole) word. Lets say I need everything before 'have' in such text: What ^7^*#/> I @@3->;: have to do with this *~~@}}], hmm...? ...so I would like to have "What ^7^*#/> I @@3->;: " as a result …

Member Avatar for edek
0
90
Member Avatar for ubc123

Excellent resource for C/C++/C#, java, JavaScript DHTML, C / ANSI-C、 SQL / MySQL it contains thousands of examples, downloadable source codes and tutorial... Please have a look。

0
56
Member Avatar for rodce

I'm a beginning C++ student/programmer, and I'm having a difficult time coming up with an algorithm to solve a programming problem. If someone could give me a recipe on how to go about solving the following problem using c++, I would appreciate it. Problem: A school has 100 lockers and …

Member Avatar for WaltP
0
686
Member Avatar for matt611

I need to read a file one word at a time. When I read the word it needs to be stored in a char* so I can pass it into my hash function. Whenever I try getline or infile>> my program just crashes. could someone please tell me what I …

Member Avatar for ravenous
0
123
Member Avatar for DREAMER546

hey .. please i need tutorial 4 vector .. because i'm tring to convert this code from array to vector .. but i failed .. so i think my way is wrong .. :( [CODE=c++]#include<iostream> using namespace std; #include<string> #include<vector> class student_recored{ vector<int> ex; string name; long ID; public: void …

Member Avatar for DREAMER546
0
102
Member Avatar for drvd80

Hello Peers, I have a sequence of data files (Site_1.txt, Site_2.txt,.....,Site_N.txt) that i need to read into my main program. Although I managed to construct the file names (as character arrays using sprintf), I am not sure of how to pass them to the ifstream, as it needs the file …

Member Avatar for Duoas
0
2K
Member Avatar for Duki

Ok, I'm going post all of my code, and hopefully someone can tell me where my error is at. I'm guessing I need to do a cin.ignore() somewhere, but I'm not sure where. I've tried it in a couple of places, but nothing has fixed the problem completely. [code=c++]#include <string> …

Member Avatar for jbennet
0
242
Member Avatar for picklesandmayo

I am writing a program that generates 2 random #'s then asks the user to give the product of the 2. I have everything (close to) working except the input. I even added a "cheat" to display the answer [inlineCODE]prod[/inlineCODE] and when inputting the exact same #, it is registering …

Member Avatar for vmanes
0
96
Member Avatar for anshul.dilli

hi plz help me overcome a few errors in my encryption project.... thanks [CODE]#include <iostream.h> #include <stdlib.h> #include <fstream.h> #include <stdio.h> #include <string.h> #include <dos.h> #include <conio.h> char passwrd[6]="",pw[7]; char pass[7],code; void genpassword(); void getpassword(); void doCrypt(char *cool) { int cryp; //the main int this function uses char x; //to …

Member Avatar for anshul.dilli
0
112
Member Avatar for picklesandmayo

I have a switch statement with 2 functions. I put 2 test [inlinecode]cout [/inlinecode] statements, both of which get displayed, but only one function is actually performed. A third test [inlinecode]cout [/inlinecode] statement is made in the second function, but that does not get displayed. "switch" and "switch2" get displayed. …

Member Avatar for picklesandmayo
0
102
Member Avatar for johnnyjohn20

Hi, I am trying to set up a program to allow the user to enter an odd number between 3 and 31. The program will then divide 360 between 1 and the user input-1. For example say the user enters 7, the program should divide 360 to each value 1, …

Member Avatar for vijayan121
0
109
Member Avatar for mikeandike22

The program calculates the standard deviation by having the user input the list of numbers into an array. So i get these errors on the program error C2057: expected constant expression error C2466: cannot allocate an array of constant size 0 error C2133: 'Nums' : unknown size here is the …

Member Avatar for Nick Evan
0
282
Member Avatar for blackslash13

Which is the most suitable source code? I need a programmer with a large experience on C++ to answer this question. [code] #include <string> #include <iostream> #include <limits> int main() { using namespace std; const int THISYEAR = 2007; string yourName; int birthYear,bad_input; cout << "What's your name ? " …

Member Avatar for Salem
0
104
Member Avatar for c.kiranmayee
Member Avatar for Amnah AL-Abdi

hello..... iam new memeber,and may be my quistion is easy to ask it,but really i need to help me in my problem. we know that the size of any array must be determined befor the running time,since it static location, my quistion is: if i need to make aprogramme in …

Member Avatar for ithelp
0
84
Member Avatar for mauriciomf

I tried strcpy() to copy AnsiStrings, but is only for (char *) type. Anybody knows how to do this, i'm using Borland C++ 6.0.

Member Avatar for mauriciomf
0
90
Member Avatar for kidjl

Hello everybody. I am beginner in programming.....However, recently i recieved a simple assigment from my Professor. The assigment asks me to use C++ and create a programe that will display a series of Fabonacci numbers after the user enter a number . For example if the user enter 10 , …

Member Avatar for jbennet
0
145
Member Avatar for powellinthesout

I don't know which one to use, cC or C++. I want the user with the client to be able to register, login, interact in the game with others, and log out. Can anyone point me in the right direction? Thank You!

Member Avatar for powellinthesout
0
118
Member Avatar for bilalb1

Hi Hope u r all well... here is my problem... i want to remove duplicate entries from a text file while maintaining the order of the text say if the text file contains 123zabc 456def 123abc 456def. 123def 456def 123abc i want the result to be like 123zabc 456def 123abc …

Member Avatar for bilalb1
0
744
Member Avatar for java.cream

[CODE]1 write out “Enter the amount: ” 2 readinAmount 3 WithVat ← Amount * 1.175 4 write out “With VAT added that becomes ”, WithVat[/CODE] If a design (or program) is purely sequential, with no loops, [COLOR="Red"]it might be thought to be very limited; the above VAT design is not …

Member Avatar for java.cream
0
102
Member Avatar for heav_yduty

Hi! I made a FTP client. And I want to add a handler to remove directory from FTP server I got one, which removes files, but I don't know how to remove directory I got this to remove files void CInetFTPDlg::OnBremove() { UpdateData(true); if (m_sFile != "") { m_fcConnection->Remove(m_sFile); UpdateData(false); …

0
54
Member Avatar for enuff4life

the function, IsPalindrome is recursive. it checks character array from 0 to end of it. i have warning message control reaches end of non-void function... whats wrong with this code? [CODE=C]int main() { length = strlen(string); boolean = IsPalindrome(string, 0, length); ... } int IsPalindrome (char* string, int left, int …

Member Avatar for WaltP
0
145
Member Avatar for gretschduojet1

Hello everyone, I haven't been stuck in quite some time, but I'm stuck. I have to read a list of names from a file, then sort them, then write the sorted names to a second file. I've been going to forum and reading articles on line but I don't understand …

Member Avatar for WaltP
0
81
Member Avatar for snowflake

Here is the implement for the Merge Sort function in my ADT. I am able to get Bubble Sort and Quick Sort working, but I get a Heap Corruption Error. template<class Type> void listType<Type>::mergeSort() { recursiveMergeSort(0, (maxSize - 1)); }//end of "mergeSort" template<class Type> void listType<Type>::recursiveMergeSort(int first, int last) { …

Member Avatar for snowflake
0
164
Member Avatar for enuff4life

in doing C, in my function OpenData, it takes a point to array in main, take command-line argument name, and arraysize pointer. i get warning passing arg of 'function' makes integer from pointer OR pointer from intgeger without a cast... what does it mean? and i get con [CODE=C]int main(int …

Member Avatar for Ancient Dragon
0
122
Member Avatar for questiontime

I dont have much experience with C++ but enough with the syntax to get my way around, i am currently on the book "Beginning game programming" by Michael Morrison...So i am pretty new to projects and linking source code together and whatnot... The book doesnt really explain how to make …

0
61
Member Avatar for dev.cplusplus

Hi to all, I have the following request/question: I’ll tell my history: I’m working in a company like a C++ programmer (for almost a year), lately I feel like I’m not going forward professional talking. I’ll explain myself: I receive assignments like fix BUGS or write small functions in the …

Member Avatar for Ancient Dragon
0
101
Member Avatar for rogenie

here is my code. I don't know why it always returns the value that i do not ask for.?? This code display the name I typed in if it is inside the array. [CODE]//this will sort strings using selection sort #include <iostream> using namespace std; const int NUM_NAMES = 20, …

Member Avatar for WaltP
0
128
Member Avatar for ricnyx

im the newbie among the newbie .....need a nice and patient guy who willing to guide me of my assignment.....cause the deadline is tis weekend......i dun know or can say hard to post the problem out...cause too many.............need urgent reply.........can msn ??? pls pls pls pls...........i got plenty of question …

Member Avatar for bilalb1
0
110
Member Avatar for juoyaf

can any one help interipre this to a code. I'm not able to figure out this code below: Read a type If that type's not 0 Read the number of pounds Repeat the steps until the type == 0 [code] for (int n=0;n<buyer.type;n++) { fin >>buyer.type; if (buyer.type !=0) {fin>>buyer.pound; …

Member Avatar for vmanes
0
86
Member Avatar for picklesandmayo

Hello, I am a new CS student and I am taking a C++ course. I am running into problems with a simple number generation program. Basically, I have to generate 2 single digit numbers and then request the user to multiply them. (I know there is nothing in there yet …

Member Avatar for picklesandmayo
0
125
Member Avatar for malathuis

Need to Modify my codes to include a function for both A and B. The function for A should have the quantity of numbers passed in as a parameter and needs to return the largest number. The function for B should have no parameters and return the smallest number. What …

Member Avatar for malathuis
0
125
Member Avatar for johnpmii

Hello, I'm tring to read a text file and pull pieces of the line into separate functions. I can open and close the file in the main. When I use the getline() it reads the whole line, I only want to read up to a certain point using strings instead …

Member Avatar for Duoas
0
161
Member Avatar for phalaris_trip

I know this is a slightly esoteric question, but I'm just curious how you guys define your function macros. Do you put a semicolon at the end or not? For example: [code=cplusplus] #define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey); // or #define EVENT_RESIZE(_event) ::SDL::HandleEventResize(_event, hScreen, fnSDLKey) [/code] In the first case, the …

Member Avatar for phalaris_trip
0
96
Member Avatar for Dha_King

Hello, i have a easy problem for u guys =). I have searched the webb but can't find a solution for it. How do i solve this kind of problems, Sorry for the spelling as usual ;)? [code] Text::Text(const char ch) { strcpy(m_str,ch); }[/code] m_str is a char *. ch …

Member Avatar for Dha_King
0
1K
Member Avatar for enes

i want to to able to access to a class's vairable but this varible is not declared class's header file it is in the cpp file i couldn't write a method that acces to it because methods cannot access it(since the variable is not in the header file) how can …

Member Avatar for WaltP
0
105
Member Avatar for scru

Just some questions. Can Visual C++ express be used to code non-CLI applications? What is the proper way to do this? What's up with the stdafx.h header? Can somebody explain what that is for please? How come I can't use stdio.h for C code in it? (yet printf and other …

Member Avatar for scru
0
127
Member Avatar for fudawala

Hi, I need some help writing this program. The question states to write a program that specifies three one-dimensional arrays named current, resistance, and volts. Each array should be capable of holding 10 elements. Using a for loop, input values for the current and resistance arrays. The entries in the …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for nicz888

how would i write a maximum number test function that will take any number of arguments and returns the greatest of them??? i know i need to used recursion function, but how should i declare the function?? here is what i have so far [code=c++] double maxNumber( double inputNum,A double …

Member Avatar for Duoas
0
143
Member Avatar for eren

The purpose of this assignment is to give practice programming in writing functions, developing algorithms and using loop structures. Positive integers can have the following personalities: prime or composite, happy or unhappy, square or not square, smug or not smug, and honest or dishonest. You will write a C++ program …

Member Avatar for Ancient Dragon
0
136
Member Avatar for tootypegs

Hi basically i have a program that gets a handle on a USB device lusing '\\\\?\\e:' but i want to be able to get a handle on it using its device instance id 'STORAGE\REMOVABLEMEDIA\7&324ACC50&0&RM:' How do i impliment this, i have tried the following below and it just doesnt work …

Member Avatar for tootypegs
0
105
Member Avatar for hellokitty88

Can someone help me with my delete function? I am having trouble figuring out why my delete function is not reporting false when attempting to delete a bank id that does not exist. Thanks. [code=c++] bool Bank::RemoveBankNumber(int bankID) { Bank *temp, *back; if (head == NULL) return false;//(isEmpty()) return; // …

Member Avatar for Ancient Dragon
0
111

The End.