2,827 Posted Topics

Member Avatar for DevC++4.9.9.2

[code=cplusplus] #include<iostream> #include<fstream> #include<string.h> using namespace std; enum mediaType {CD, TAPE, MP3}; struct Song {char title[20]; char artist[20]; mediaType medium; float cost; }; Song *getData(ifstream&); void searchData(Song*[200], string, int); int main() { ifstream indata; indata.open("song.txt"); string artistName; Song *songs[200]; int x=0; cout << "Input Artist Name.\n"; cin >> artistName; *songs …

Member Avatar for VernonDozier
0
166
Member Avatar for code12

Make sure you don't have any spaces in the code tags. [noparse] [code=cplusplus] // code [/code] [/noparse] Not this [noparse] [code = cplusplus] // code [/code] [/noparse] [code=cplusplus] void delete(string contacts[], string fName, string lName, ifstream& aInFile, ofstream& aOutFile) { cout << "DELETE A CONTACT\n"; cout << "Type the contacts …

Member Avatar for code12
0
135
Member Avatar for mnv29brt

You need to use some C++ code tags so you get the line numbers, do some formatting so it's readable, and be more clear with your question. [noparse] [code=cplusplus] // paste your code here [/code] [/noparse] I think you need at least one more constructor: [code] Poly (double coeff[], int …

Member Avatar for dougy83
0
4K
Member Avatar for blaec

[QUOTE=blaec;581465]I dont understand how to use: std::sort(strarray.begin(), strarray.end()); changing to if( ch >= '0' && ch <= '9') still gives me same result (underscore)[/QUOTE] I think you're going to have to post your updated program for us to understand what you have tried.

Member Avatar for blaec
0
209
Member Avatar for veronicak5678

So the first program creates biblio.txt and the second program is supposed to read from biblio.txt and fill in the missing data? What does biblio.txt look like? You may want to #include your class in your second program too. That would probably mean splitting that first file from one file …

Member Avatar for veronicak5678
0
150
Member Avatar for mnv29brt

That's way too much to read without code tags and formatting. [noparse] [code] // Paste your code here. [/code] [/noparse] or [noparse] [code=cplusplus] // Paste your code here. Adds line numbers and syntax highlighting. [/code] [/noparse]

Member Avatar for mnv29brt
0
125
Member Avatar for Black Magic

[QUOTE=Black Magic;581437]Thanks, i'm just really mucking around atm but im going to make somethings like Elliot.setAge(81); in a minute or two :) Btw, can you tell me another alternative to system("PAUSE>nul"); Because pause nul gets rid of press any key to continue, What other solutions can i use? EDIT: Is …

Member Avatar for Black Magic
0
101
Member Avatar for rikkie

So if seats[1][3] ='!', that means that the 4th seat of the 2nd row is taken (adding 1 to array indexes to get row and column)? And that seat is available if seats[1][3] = 'U'? When a seat is reserved, it changes from 'U' to '!'?

Member Avatar for rikkie
0
180
Member Avatar for knewc

[QUOTE=knewc;581137]I know what recursion is sir...though thank you for your help!!! i just dont understand what output he wants...or what type of function he wants[/QUOTE] [QUOTE=knewc;581096]*EDIT* INTERPRET! lol....sorry! Write a recursive function array_sum(int *array, int size, int index) that computes the sum of all the elements of the array starting …

Member Avatar for VernonDozier
0
96
Member Avatar for jimJohnson

DecimalFormat might come in handy here. [url]http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html[/url] Here is an example. [url]http://www.daniweb.com/forums/post101822-4.html[/url]

Member Avatar for Ezzaral
0
540
Member Avatar for Black Magic
Member Avatar for Black Magic
0
86
Member Avatar for buddha527

I think you need to attach "home12.h" for us to be able to run it and help. Also, do you need to #include the "functions.cpp" file in main.cpp in order to call the "mystery" function from main?

Member Avatar for buddha527
0
117
Member Avatar for CE Student

[QUOTE=Ancient Dragon;577376]Nobody is going to do your homework for you without pay.[/QUOTE] Looks like someone did.

Member Avatar for ivailosp
0
219
Member Avatar for CaffeineCoder

Decide where you want to put the buttons on the GUI, place them there, and add ActionListeners to them. Each new button represents a key that was pressed before. Decide which buttons go with which keys. Say a button called kButton was assigned to do the same thing as what …

Member Avatar for CaffeineCoder
0
162
Member Avatar for TMD

First off, cool maze program. I compiled it and ran it in Dev C++ and was able to manuever through the maze and have my character move in the direction I wished to what (I believe) is the goal (a hole in the wall on the right side of the …

Member Avatar for ivailosp
0
345
Member Avatar for Trckst3
Re: sort

[code=cplusplus] #include <iostream> #include <iomanip> #include <algorithm> using namespace std; int main() { int i,num[20],n,j,choice,tmp; cout<< "Please enter 20 integers"; for (i=0; i<20; i++) { cout<<"\nEnter next value:"; cin>>num[i]; } cout<<"\n1.Display original data.\n"; cout<<"2.Sort the data into descending order\n"; cout<<"3.Display the sorted data (Only if you've already sorted)\n"; cout<<"4.Get the …

Member Avatar for Sky Diploma
0
118
Member Avatar for mussa187

[QUOTE=mussa187;577676]I am trying to check the input for 8 bit an unsigned integer.[/QUOTE] I don't understand what you are trying to do. What are you checking?

Member Avatar for chiwawa10
0
83
Member Avatar for kemo0o

Well this is the C++ forum. I'm sure you can do all of that in C++, though I have no idea how so I'm of no help if you go the C++ route. However, Java has the Swing library, which has a lot of these function written for you if …

Member Avatar for Ancient Dragon
0
102
Member Avatar for tosh123

I'm trying to make sense of this. Can you post the Node struct and your declarations of the BaseStation variable and the arrayOfNodes array?

Member Avatar for tosh123
0
152
Member Avatar for Kaushalya

[QUOTE=Kaushalya;576866]Wish you all a good day.Currently i'm working on c++ project.I want to know how to convert string object to a character array.Also why ifstream object doesn't accept a string variable as follows, void split(String filename) { ifstream ifile; ifile.open(filename);//this fails }[/QUOTE] A string already is a character array. See …

Member Avatar for VernonDozier
0
103
Member Avatar for obsolucity

This code is a prime candidate for a loop: [code=cplusplus] int c = 1; a[c++] = 16; a[c++] = 15; a[c++] = 14; a[c++] = 13; a[c++] = 12; a[c++] = 11; a[c++] = 10; a[c++] = 9; a[c++] = 8; a[c++] = 7; a[c++] = 6; a[c++] = 5; …

Member Avatar for Laiq Ahmed
0
320
Member Avatar for mod_motox

I would imagine you could create a vector of char*. Go through your vector of integers, use itoa on each individual integer to create a string, then push that new string onto your vector. Note that itoa converts to a char*, not a C++-style string. itoa wouldn't work on an …

Member Avatar for iamthwee
0
242
Member Avatar for WonderWomen204

The order that you are calculating is the order that you are displaying. This is because you are not storing earlier calculations. Data must be immediately displayed or it is lost. You need to do one of two things: Option 1: Set aside storage in an array, vector, or linked …

Member Avatar for WonderWomen204
0
174
Member Avatar for christiangirl

[code=cplusplus] #include <iostream> #include <cstdlib> #include <string> using std::string; using namespace std; int main() { int random = rand(); int money = 100; int bet; bool correctbet = false; int Hcard[10]; int ccard[10]; string hroyal[10]; string croyal[10]; int totalace = 0; int totalace2 = 0; int numcards; int totalh = …

Member Avatar for christiangirl
0
119
Member Avatar for Megaz221

[QUOTE=Megaz221;576654]Hi, I'm back again. Anyways, I have been working on a little project on my own. But I have a question about something. How would jumble characters in a string around. Let's say user inputs a word computer , the program then jumbles the characters in the string to mpcotreu. …

Member Avatar for VernonDozier
0
280
Member Avatar for pship07

[QUOTE=pship07;576458]I need to make a program to do the following: 1. ask the user for the name of the input file, and open/read it. 2. For each well-formed cout statement, i must execute it. For any malfunctioned cout statement, print an error message. the syntax of a well-formed cout statement …

Member Avatar for VernonDozier
0
105
Member Avatar for White-Gandalf

I ran this program in Dev C++ and got the same non-error: [code] #include <iostream> using namespace std; int foo (int a); void do_something (int a); int main () { int a = 5; int b = 10; b = foo (a); cout << "In main post call: a = …

Member Avatar for Narue
0
266
Member Avatar for Agni

I remember once trying to call Java Swing functions from C++ code so that all the calculations could be done in C++ and the graphical stuff in Java Swing, and we never really got it to work. The two pieces worked fine separately, but C++ and Java couldn't communicate. This …

Member Avatar for ithelp
0
201
Member Avatar for jimJohnson

[QUOTE=jimJohnson;574689]I have an exam tomorrow and just going over quizzes I did not do all that good in and was wanting to know if anyone could assist me w\ my mistakes Quiz 6 This question asks me to put in the output int Function_one(int y, int x); int main() { …

Member Avatar for ithelp
0
80
Member Avatar for sfurlow2

Sure. [code=cplusplus] int numEndl = 8; for (int i = 0; i < numEndl; i++) cout << endl; [/code]

Member Avatar for VernonDozier
0
73
Member Avatar for Katherine692008

I can only think of two ways to repeat the code in your while loop. One, another type of loop, like a for loop (though in this case a while loop seems to make a lot more sense) or through recursive calls to a function. I can't think of any …

Member Avatar for VernonDozier
0
72
Member Avatar for cnet1989

So it sounds like this is data that gets paired together. So you have something like this: [code] 1 R 2 B 3 F 4 W [/code] where 1, 2, 3, 4 are song numbers. And R, B, F, W are letters representing song type? And you want to randomize …

Member Avatar for cnet1989
0
93
Member Avatar for demroth

[QUOTE=demroth;572148]I have been reading the posts on radix sort here at DaniWeb and at [url]http://www.cubic.org/docs/radix.htm[/url]. I have already created the code for the counting sort which will do the rest but I do not understand how to do the radix part. I guess what I am asking is if you …

Member Avatar for demroth
0
122
Member Avatar for annapink

Well I can't give it to you, but maybe I can point you in the right direction. Let's look at what the end result is and work backwards: [QUOTE] What you should hand in The following should be submitted to the Campus office in hard-copy form: * A listing of …

Member Avatar for VernonDozier
0
111
Member Avatar for Carwy

Sorry to hear you have cancer. I wish you the best on that. That doesn't change the fact that you are acting like a complete jerk. You have no idea who sits at a desk all day, who doesn't, and who has been to Iraq and Afghanistan. That's all irrelevant …

Member Avatar for Salem
0
447
Member Avatar for Noliving

[QUOTE=Noliving;573734]I've come up with this now: [code=java]public static double power(double x, int n){ if (n == 0) return 1; else if (n > 0) return x * power(x,n - 1); else return (1.0 / power(x, Math.abs(n))); }[/code][/QUOTE] That seems like it should work to me. Pretty clever, actually. I've never …

Member Avatar for Noliving
0
240
Member Avatar for Jacky1

[code] void Bst<generic>::insert([COLOR="Red"] generic x[/COLOR]) [/code] x is type "generic". [code] struct Bsn { Bsn * p; Bsn * l; Bsn * r; [COLOR="Red"]generic * data[/COLOR]; }; [/code] data is type "pointer to generic". [code] if( m_root -> r == NULL && [COLOR="Red"]x[/COLOR] > m_root -> [COLOR="Red"]data[/COLOR]) [/code] You are …

Member Avatar for Jacky1
0
2K
Member Avatar for ElectorCount

[QUOTE=ElectorCount;569976]i tried that and im confused as what to do with the array i created. Also, im using Microsoft visual C++ 2008 and it doesnt seem to like your code. Is there any specific thing i need to include?[/QUOTE] Did you put these lines at the top? [code] #include <vector> …

Member Avatar for VernonDozier
0
337
Member Avatar for Traicey

It's called "typecasting". [code] int a = 5; double b = (double) a; double c = 4.0; int d = (int) c; [/code] chandra.rajat is correct in many cases. The compiler will figure out the typecasting above without being told and unlike Java, C++ doesn't demand all of the explicit …

Member Avatar for Traicey
0
23K
Member Avatar for Ice_Dragon

Here's the syntax of an if-statement: [code] if (condition) { // execute this code if condition is true } [/code] You have this: [code] if chChar == a; [/code] You need parentheses areound the condition and you need to get rid of the semicolon.

Member Avatar for Ice_Dragon
0
142
Member Avatar for code12

You don't need a loop as far as I can tell. Just ask three questions in a row and assign the answers to the appropriate variables. You don't want the [20] in the code unless the last name, first name, and phone number are each only one character. If you …

Member Avatar for VernonDozier
0
244
Member Avatar for Galaxiaunit

[code=cplusplus] #include<iostream.h> #include<conio.h> #define max 1000 //------------------------------------------------------------------------------ struct moto{ char gra[10]; rodzaj[10]; int rok_produkcji; }; moto game[max]; void main() { clscr(); cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";(from Polish Users message:How many Games you wish to type in ?) int n; cin>>n; for(int i=0; i<n;++) { cout<<"\n\n Podaj nazwe ",, …

Member Avatar for Traicey
0
574
Member Avatar for VernonDozier

This came up in another thread. I gave some advice that I'm not longer sure of. Rather than hijacking that thread, I figured I'd start my own. I advised against using the == in that thread. The context was this: [code=cplusplus] string subChoice =""; getline(cin,subChoice); if (subChoice == "100") { …

Member Avatar for VernonDozier
0
924
Member Avatar for WonderWomen204

[code=cplusplus] #include <iostream> #include <string> #include <cstdlib> #include <ctime> using namespace std; int main() { int min, max, number = 0; unsigned seed = (unsigned long) (time(NULL)); srand(seed); cout << "Please enter an integer: "; cin >> min; cin.ignore(); cout << "Please enter another integer: "; cin >> max; int …

Member Avatar for WonderWomen204
0
121
Member Avatar for jimJohnson

Read post 9. [code=cplusplus] int Convert_Let_to_Num(int number) { char grade = 0; if ((grade == 'a') || (grade == 'A')) { number = 4; } if ((grade == 'b') || (grade == 'B')) { number = 3; } if ((grade == 'c') || (grade == 'C')) { number = 2; …

Member Avatar for BlackJavaBean
0
442
Member Avatar for bramprakash1989

Three threads, same exact question. [url]http://www.daniweb.com/forums/thread116424.html[/url] [url]http://www.daniweb.com/forums/thread116396.html[/url] [url]http://www.daniweb.com/forums/thread116165.html[/url]

Member Avatar for Lerner
0
145
Member Avatar for dallaseve

I think the isalpha, islower, isupper, toupper, and tolower functions from the cctype library will come in handy here: [url]http://www.cplusplus.com/query/search.cgi?q=cctype[/url] Isolate each character, then test that character with the isalpha function to see if it is a letter. If it IS NOT a letter, just display the character. IF it …

Member Avatar for dallaseve
0
105
Member Avatar for farkasember
Member Avatar for VernonDozier
0
71
Member Avatar for bramprakash1989

Four threads, same question: [url]http://www.daniweb.com/forums/thread116166.html[/url] [url]http://www.daniweb.com/forums/thread116394.html[/url] [url]http://www.daniweb.com/forums/thread116401.html[/url] [url]http://www.daniweb.com/forums/thread116409.html[/url]

Member Avatar for VernonDozier
0
262
Member Avatar for Moporho

What exactly are you trying to display here? (see red): [code] cout << setw(6) setprecision(0) << fixed << i << setw(18) << setprecision(2) << fixed << [COLOR="Red"]ftC(i)[/COLOR] << setw(17)<< setprecision(0) << fixed << i << setw(18)<< setprecision(2) << fixed << c << endl; [/code] ftC is a void function. If …

Member Avatar for JRM
0
183

The End.