2,827 Posted Topics
Re: You have two threads on the same topic. Please mark one of them solved. Also, please use code tags. [noparse] [code=JAVA] // paste code here [/code] [/noparse] | |
Re: [QUOTE=swbuko;694495]I've got 5 arrays each with one number in them, but in order to sort them using the insertion method, I need to combine them into a single array. How do I do this? This is the last part of my program and can't figure it out![/QUOTE] More details please. … | |
Re: You have not included the library that cin comes from (iostream) and you have not told the compiler that when you use the word "cin", you are referring to the function "cin" from iostream. Try adding these two lines at the top of your program: [code] #include <iostream> using namespace … | |
Re: [QUOTE=zwench;691622]Well right now it brings up the box that has the buttons for the graduate and undergraduate files. What you posted is what it is SUPPOSED to do...lol. Once I push either button it closes. actually since i posted that i have added this; [code] try { IdNum = undergradStudentInStream.readInt(); … | |
Re: I for one don't understand what the algorithm/approach is here. Aside from that, I think you should clean up the code. One, since this is C++, convert input and output to cin and cout. Two, I don't see where you use buf now, so I'd take those lines out. | |
Re: [QUOTE=janustt;692597]After each of the die is rolled I have to display something like this: if the roll is say a 6, i display * * * * * *[/QUOTE] You can write a function like this: [code] void DisplayRollWithAsterisks (int roll) [/code] Decide what the asterisks look like for each … | |
Re: I assume this is a typo? [code] System.out.println("Deduction for Federal Income Tax (15%): " + [COLOR="Red"]deductFederalTax[/COLOR]); [/code] Should it be [ICODE]deductionFederalTax[/ICODE] ? If it is, it's still not going to work because [ICODE]deductionFederalTax[/ICODE] is a[B] local [/B]variable in the [ICODE]calculateNetMonthly()[/ICODE] function and therefore you can't use it in the [ICODE]display … | |
Re: [code] while(myfile.good() == false)// Prompt for new file name if not able to open { cout << "Unable to open file. Enter a different name: "; cin >> fileName; myfile.open(fileName); } [/code] You need to [URL="http://www.cplusplus.com/reference/iostream/ios/clear.html"]clear [/URL]the error flags before trying to open the file again when you are in … | |
Re: [QUOTE=kogues;692612]Ok, I'm taking a intro to programming with java class, and for the most part I've been able to keep up with the assignments. I'm in the process of writing a statement that will output the cube root of a number, I've come up with the below as what I … | |
Re: [QUOTE=brodster89;692616]I have to write a code where I tell the user to enter a sentence that has at least three commas. Then i have to print out each of the three words that appear after each of the first three commas. I am so lost and it is just introductory … | |
Re: [QUOTE=timelapse;691930]I'm trying to create a program that will deal a random card, and I am VERY confused about how to go about making it. I understand arrays/strings in general but I have no idea where to start. My professor states that we will use the function rand() which returns pseudo- … | |
Re: [QUOTE=chunalt787;691079]Hey does anyone have a basic binary multiplication function and or algorithm? I just need to record run times on it for varying amounts of input and don't want to have to spend an hour doing a solved problem for 5 points on a HW. Thanks in advance[/QUOTE] Wow. Talk … | |
Re: [QUOTE=kyosuke0;691308][COLOR="Red"]if i did not have it in there[/COLOR] the for loop would load the first country it gets from the infile into every nation member in the array.[/QUOTE] vmanes isn't suggesting that you take out the [ICODE]break[/ICODE] statement that have. He's suggesting that you add ANOTHER [ICODE]break[/ICODE] statement. | |
This is a simplified version of a larger project. I have three JPanels contained in a larger JSplitPane called [ICODE]wholePanel[/ICODE]. The top panel and left panel hold labels and buttons, which I have not included here. The lower right panel, called [ICODE]canvasPanel[/ICODE], is where I draw shapes. I'm trying to … | |
Re: The get and set methods refer to getting and setting these variables: [code] //private variables private String destination; private String employeeID; //ID for the employee private String employeeName; //Name for the employee private int hourlyRate; //the amount in dollors for employee private int numberHours; //number of hours worked each day … | |
Re: [QUOTE=DJPlayer;691045]well I'm just stating this one and my brain is about racked w/ the # of assignments going on.. anyways. I have to write a program where a user will input a integer and it will determine the kaprekar #'s of that #, until it reaches the user # input. … | |
Re: [QUOTE=daesdaemar;691134]I am trying to write a simple slot machine program that will return three numbers as the slot icons using a loop. I can get the first part just fine (I think). But I am stuck at converting my icons to intergers or character that I can compare to see … | |
Re: [QUOTE=khushal_kkk;615413]the code that i have coded is of operator overloading for incrementing and the i need some help in the operator overloading for decrementing ,mutiplication and division please send the following in a code form shall be thankful.. [/QUOTE] What's the question? You need to ask a specific question and … ![]() | |
Re: Wikipedia has a better explanation than the one you are going from above. I'd use it instead and toss out the one you posted. The notation is better. It also has an example using numbers. Each iteration is based on the previous iteration and will get you progressively closer to … | |
Re: [QUOTE=redflame777;691315]I noticed that when this message posted it did not display the '^' correctly it should be pointing to the end of the line instead of the bracket at the begining. Sincerely,[/QUOTE] If you put that in code tags, even though it isn't code, spacing will be retained. Otherwise all … | |
Re: One, multiplying by 3, then adding or subtracting 1 isn't the Fibonacci sequence. Two, I don't see the need for recursion here. What exactly is this function supposed to do? If it simply takes a number in the sequence and returns the next number in the sequence, there is no … | |
Re: If you are going to use the modulo operator, convert everything to cents first. So, say you are trying to figure out how many ten dollar bills are in $38.45. Ten dollars is 1000 cents. $38.45 is 3845 cents. You use the / operator to calculate the number of tens: … | |
Re: [QUOTE=Trekker182;690711]I have to take a 2d array of [6][8] floats that represent a star map and add the four surrounding numbers to it to measure it's intensity of light. Would something like make sense??? [CODE]for(i=0;i<6;i++) { for(j=0;j<8;j++) { stars[i][j+1] + stars[i+1][j] + stars[i-1][j] + stars[i][j-1];}}[/CODE] instead of writing many lines … | |
Re: [QUOTE=LuckyMe444;690674]Thank you. That makes sense! Any clue on how to get the array of iputted data to display before the sorted result?[/QUOTE] You only have one array, so sorting the array is going to overwrite the unsorted array. So if you want to display the unsorted array, you either need … | |
Re: [CODE=cplusplus]#include <iostream> #include <iomanip> using namespace std; const int numofgrades = 10; void getGrades(double grades[]); double computeAverage(double grades[]); double getMax(double grades[]); void countPassing(double grades[]); int main () { double grades[numofgrades]; double avg; double largest; getGrades(grades); computeAverage(grades); getMax(grades); countPassing(grades); system ("PAUSE"); return 0; } void getGrades(double grades[]) { cout<<"Please enter 10 … | |
Re: [QUOTE=Yaserk88;690709]Ok. I'm not experienced at all, and I need to program a set of different math formulas into a code. Here is the first step I'm trying to take. I have an octahedron that has 8 plates. Each plate is composed of 3 vectors. There are 6 vectors in total … | |
Re: [QUOTE=williamhemsworth;690569]Read this before posting.. see if you can figure out what you did wrong, all by yourself :icon_wink: [URL="http://www.daniweb.com/forums/thread78223.html"]http://www.daniweb.com/forums/thread78223.html[/URL][/QUOTE] I thought that assignment looked awfully familiar, then when I saw the menu it rang another bell. I commented on a thread with the exact same menu, then I typed "Bacon … | |
Re: Here are your variable names. If it's not in this list and it's not a local variable, JAVA can't find it: [code] private String employeeName; //name of employee private int hours; // when used double here errors occured. private int rate; private int pay; [/code] Here's your function: [code] public … | |
Re: [code=c] int main() { int i; char a[32],*a1,b[64],*b1; a1=&a[0]; b1=&b[0]; for (i = 0; i < 26; i++) a[i] = i + 65; a[26] = 0; printf ("address of a1 = %d\n", a1); printf ("address of a = %d\n", &a[0]); printf("contents of a1: %s\n",a1); printf ("Contents of a: "); for(i=0;i<=25;i++) … | |
Re: [QUOTE=ron_jay;689882]suppose I have a an array a[5]={1,2,3,4,5}; [code] func(int b[]) { if(b[0]<6){ return; } else { for(int i=0;i<5;i++) b[i]+=1; func(b); // at this point A } } [/code] so when the array has been reached the base condition i.e. 5,6,7,8,9,10 and starts to return back to the function that called … | |
Re: [QUOTE=Synthuir;690207][CODE]#include <iostream> #include <string> #include <time.h> #define newline '\n' using namespace std; char ch; int main() { cout<<"*A Signed on\n*I Signed on\n"; cout<<"\nA:It's you again, isn't it?\n>I:"; string ent1; cin>> ent1; while(ent1 == "yes" || ent1 == "Yes" || ent1 == "YES") { cout<<"A:No...\nA:It's been so long since you last … | |
Re: [QUOTE=kylcrow;689893]Hi everyone. I wrote a Rock Paper Scissors program my first quarter of C++ two years ago, and now I have a job at a programming job. I showed someone my little easy program and they challenged me to make a verson 2.0 with AI and a gui. The Gui … | |
Re: [QUOTE=guitarcrazy44;689355]I have signed up for high school online c++ courses, which has proven to be a mistake, due to my inability to grasp the content. I would like to keep learning, but as the semester draws to an end, I must catch up on my work. This is a project … | |
Re: [QUOTE=sanfan49er;686805]CIS350 Project Choose one O(n log n) and one O(n2) sorting algorithm. Choose a third algorithm of any time complexity. For each of the three algorithms you have chosen, implement the algorithm. Then, write a short piece of code that will generate the following: 1. A file of 1000 random … | |
Re: [QUOTE=Lardmeister;686744] Is a democracy of misinformed or uninformed people really a democracy?[/QUOTE] Absolutely. One of democracy's main tenets is that an uninformed, misinformed, lazy, stupid citizen's vote counts as much as an informed, industrious, intelligent citizen's vote. If you spend ten hours deciding which candidate to vote for by delving … | |
Re: Post your attempt. [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: [QUOTE=Ancient Dragon;687792]Has anyone been able to compile the lib files using Microsoft Visual C++ 2008 Express compiler? I downloaded and installed MySQL 5.0 Server yesterday, then downloaded MySQL++ source. Attempted to compile and got a bunch of link errors. I used dumpbin.exe to get a list of all the symbols … | |
Re: [QUOTE=smileeok;687249]I have a question about the memory allocation of class. My compiler is GCC 4.1.2. I define a class called Foo, create three objects of it, and have a look at their addresses. Following is my code: [code=c++] class Foo { int k; }; int main() { Foo f1, f2, … | |
Re: [QUOTE=aussie_chick;688050]I've done the user input and declared the array, just not sure how to go about row and column sizes and the input of the weight and height....[/QUOTE] Please post what you have so far. | |
Re: [QUOTE=ohyeah;676570]Which compiler should I use?[/QUOTE] Use whatever compiler you want. If you're running it through an IDE, some IDEs keep the console window open with the "Press any key..." message. Dev C++ will run all the way through without showing that message. The console window just closes when the program … | |
Re: [QUOTE=bricjames;687702]ok well yea how about something a lil bit easier I will post my code that i have right now // Bric Browning //ASCII Adder #include <stdio.h> void math() { int num; int x; int sum; printf("=========\n"); printf("Math Help\n"); printf("=========\n"); printf("Input first digit: "); scanf("%d", &num); printf("Input second digit: "); … | |
Re: [QUOTE=the universe;683787]Hello, Does anybody know how to write a command to generate a random array (let's say with 100 numbers) that contains numbers from a function that goes like y = x exp (2.5). where the range of x is given. I hope that my question is understandable :-) Thank … | |
Re: Start by deciding what the objects should be, then decide what data these objects need to hold and what methods they need to have and how different types of objects of relate to one another. From there you'll decide what classes are needed and make each different object type into … | |
Re: Looks to me like no new nodes are created in this loop: [code=cplusplus] while(!ins.eof()) { ins >> temp->base; temp->next = NULL; if (head == NULL) head = temp; else { node* z; z = head; while (z->next != NULL) { z = z->next; } z->next=temp; } } [/code] You are … | |
Re: [QUOTE=nizbit;687107]To get the data from the input file, just use cin. For example: [CODE] int main(){ //From previous posts you have the code that goes here char command[100], array[100]; cin >> command;//A clue would be put this in a loop //In the loop cin >> array; [/CODE][/QUOTE] cin takes input … | |
Re: I get an error in this line: [code] getline (cin , cash) ; [/code] Error message: [quote] no matching function for call to `getline(std::istream&, double&)' [/quote] | |
Re: It looks like you're doing the [ICODE]switch[/ICODE]/[ICODE]case[/ICODE] right, or at least if it isn't, it doesn't have anything to do with [ICODE]int[/ICODE] versus [ICODE]char[/ICODE] as far as I can see, but you're not doing line 47 right: [code] while (choice < 1 || choice > 5) [/code] Note that in … | |
Re: [QUOTE=Nemoticchigga;686824]how?[/QUOTE] Set up your 2-D array of integers, then read values into the array with the [ICODE]>>[/ICODE] operator. [code] indata >> array[i][j]; [/code] | |
Re: Here's an interesting recent link from some Nigerian official who thinks that the victims are as guilty as the perpetrators and should be arrested too: [url]http://merimbula.yourguide.com.au/news/national/national/general/jail-the-greedy-scam-victims-says-nigerian-diplomat/1251111.aspx[/url] | |
Re: [QUOTE=woody292;686393]Hello all. I am working on a programming 2 lab and am unsure how to code the input and output for this assignment. Here is what the lab sheet says: "Your program will be expected to read input from the first file specified on the command line and to write … |
The End.