2,827 Posted Topics
Re: [QUOTE=inkcoder;686275]This doesn't work: [ICODE] if (m == 1,2,3) { cout<< "Sorry you cannot go any farther north.\n"; }[/ICODE] How can I make this work? Ink[/QUOTE] [code] if (m == 1 || m == 2 || m == 3) [/code] | |
Re: You can't use [ICODE]string[/ICODE] in C. Also, we can't run the program since you haven't provided the [ICODE]GetLine[/ICODE] and [ICODE]GetInteger[/ICODE] and [ICODE]StringCompare[/ICODE] functions. | |
Re: [QUOTE=devnar;685686]I have tried to come up with a 2-D (4 rows and 4 columns) array which holds values from 0 to 15, with none of the values used more than once. I'm posting only the code snippet. please lemme know if the logic is correct. [CODE=C] int HIGH=16; /*(Max value … | |
Re: [QUOTE=nizbit;685598]I have an input file that has call to function and arguments that are passed to that function. There might be one argument or two. A simple while loop for input will not work ex-while(inputf >> function >> arg1 >> arg2) because if a function has only one argument then … | |
Re: [QUOTE=vidit_X;685140]Salem gave me the hint, but I dont got it. :( Thanks Lerner for helping.[/QUOTE] "I don't get it" isn't helpful. You need to be more specific. What don't you get? The point is that this function is inefficient: [code] int prime(int a) { int i; for(i=[COLOR="Red"]2[/COLOR];i<=sqrt(a);[COLOR="Red"]i++[/COLOR]) if(a%i==0) return 0; … | |
Re: [QUOTE=nizbit;685281]The recursive function is only reversing the first and last characters of a string. I've been trying for hours but cant find the error. Any help would be awesome. The code: [CODE] #include <iostream> #include <string> using namespace std; void str_reverse(char str[], int length) { char temp, temp1; int starti=0; … | |
Re: obj7777 is correct. Look at this link for a more in depth discussion: [url]http://www.dreamincode.net/forums/showtopic30581.htm[/url] | |
Re: [QUOTE=zaaweel;685153]Hello, i just started with on my new school and we are going to make an application that ask how old you are. If you're 13 to 19year old it should say ''Teenager'' But if you write for example 8, it should say '' little kid ". I started to … | |
![]() | Re: [QUOTE=Ayu1004;685062]well i didn't have to include anything except string with working with strings and getline, and getline works... but there's another problem. i always have to press enter twice for another line of code to read ;_;[/QUOTE] We have absolutely no way of knowing what you are talking about. Post … ![]() |
Re: [QUOTE=lentilly;684593]I have a minimac and recently added my grandchildren as users. I used the parental control options when setting their own log ins but need to make some changes. This is where all my dramas began. I have tried every which way to gain access to their account but am … | |
Re: Looks like you have some Assembly code mixed in with the [ICODE]GetLineCount ()[/ICODE] and [ICODE]GetLastText () [/ICODE]functions. I have no idea whether those functions are correct or not. In addition, I'm not familiar enough with Windows functions and DWORD, plus I have to relearn [ICODE]malloc[/ICODE] every time I use it, … | |
Re: Code tags please: [noparse] [code] // paste code here [/code] [/noparse] Also, is this C or C++? You have [ICODE]printf[/ICODE], [ICODE]scanf[/ICODE], and [ICODE]stdio.h[/ICODE] . If it's C, there is a C forum on Daniweb. | |
Re: [QUOTE=TechNovice;683705]I think I"m confusing you. Sorry. The date is already in this format: mm/dd/yyyy. So the char[10] would be incorrect usage, rigth?[/QUOTE] [code] while (date >> expense) // reads the [COLOR="Red"]file[/COLOR] [/code] date is a variable, not a file and not a stream. [code] const int arraySize = 100; int … | |
Re: [QUOTE=chenzhp;683433]Why static data member 'int' could initialize in class body? but 'double' can't? eg: class Example { public: static double rate = 6.5; //wrong... static int versize = 20; //right } double Example::rate = 6.5; //yes What reason by design that syntax ?[/QUOTE] Don't forget the semicolon to end the … | |
Re: Keep in mind that not everyone here will have an operations research background. I think you're going to probably have to explain the problem a little more clearly. To avoid confusion, make sure that no time has the same value as a job number because it's not clear, to me … | |
Re: [QUOTE=PuQimX;682480]i want to write a program that determine a student’s grade. It reads three test scores (between 0-100) and calls a function the calculate and return a student’s grade based on following rules: (a) If the average score is 90% and more, the grade is ‘A’ (b) If the average … | |
Re: [QUOTE=PuQimX;682478]I'm new..please teach me if i wrong.. i'm still learning. sorry for my effort.[/QUOTE] The point is you're NOT making an effort. This isn't a "Hello World" program, so I assume you already know how to call a function. So set up a skeleton of three empty functions that do … | |
Re: Again, code tags are important: [noparse] [code] // paste code here [/code] [/noparse] or [noparse] [code] // paste code here [/code] [/noparse] You already have other threads on this topic. Please don't start new ones. Keep one of them open and mark the others solved so people know where to … | |
Re: [QUOTE=ferret_90;680778]I want to be able to activate an easter egg in this program, but passing and reading these arguments is making me pull my hair out. Any ideas? [CODE] int main(int argc, char *argv[]) { if (argv[1] == "/e") easteregg(); [/code] [/quote] Close, but as the previous poster mentioned, test … | |
Re: [code=cplusplus] char *cstrstr(char s[],char ss[]) { size_t l1, l2, i, j, k; int flag = 0; char *p = NULL; l1 = strlen(s); l2 = strlen(ss); for (i = 0; i < l1; i++) { p = &s[i]; if (ss[0] == s[i]) { for (k = i, j = 0; … | |
Re: [QUOTE=jianxu;681469]Hi, I am currently working on a homework assignment with the topic being a boggle game. We are creating the boggleboard class and one of the function that must be included is this: bool playWord (string word, string player) This method returns false if word does not appear in the … | |
Re: Like vmanes said, please use code tags. It makes things much easier to read. [noparse] [code] // paste code here [/code] [/noparse] | |
Re: [QUOTE=TheBeast32;681468]I found this: [Code=C++] while (*atts) { printf(" %s='%s'", atts[0], atts[1]); atts += 2; } [/Code] It works, but I have no idea what it's doing.[/QUOTE] You found it where? Define "it works" and under what circumstances? I know nothing about Expat, but there are an awful lot of programs … | |
Re: [QUOTE=LiquidScorpio81;681482]How do I sort 10 random numbers using quick sort with push() and pop() ?[/QUOTE] You already asked this question and there's a good reason nobody responded to it. It's because you haven't displayed any effort at all on this. I responded to your last thread regarding Bubble Sort because … | |
Re: [code=cplusplus] #include<iostream> using namespace std; void BubbleSort(int ar[10], int n, int & compare_costs, int & swap_costs) { int t; int swaps=-1; while(swaps) { swaps++; compare_costs++; for(int i=0; i<n-1; i++) if(ar[i] > ar[i+1]) { t=ar[i]; ar[i]=ar[i+1]; ar[i+1]=t; swap_costs=swap_costs+5; } } } int main() { int n, compare_costs, swap_costs; int ar[10]; int … | |
Re: [QUOTE=henpecked1;679869]okay, I understand most of what you've done, what does including the windows.h file give me? I've never used it before[/QUOTE] I just glanced at littlestone's code, so I'm not sure whether you need windows.h to use it. I didn't see anywhere at first glance where you needed it, which … | |
Re: [QUOTE=henpecked1;674428]I'm having trouble getting my delete function to work for a singly linked list. If I try to delete anything other than the entire list, it deletes everything up to that node. I know there is something wrong with it, but I can't tell what it is. I would like … | |
I want to draw some text on a JFrame (later it'll change to a JPanel), but not have the text necessarily be horizontal. I've found some decent examples online that have worked well, but they've all been 500+ lines long. I'm hoping it can be done in a way that's … | |
Re: What happens when you run it? I'm guessing you are possibly getting a segmentation fault error in line 122 below due to your attempt to access element [ICODE]grid[SIZE][SIZE][/ICODE] . Arrays in C++ start at 0 and go to SIZE - 1. Or are you trying to do a deep copy … | |
Re: [QUOTE=shamila08;677400]Hello, everybody! i have a problem with permutation array. most algorithm related to permutation, list down all permutation for n!. however, i would like to generate c++ output as follows: 1234 1243 1342 1324 1423 1432 which is we fix the element '1', and cycle others. and soon. i hope … | |
Re: I don't know how to use the math BBCode, so this post won't look as good as it could, but focus on the concept. I'm going to just use [ICODE](n choose m)[/ICODE] to denote the statistical [URL="http://www.andrews.edu/~calkins/math/webtexts/prod02.htm#COMBO"]combinations[/URL] Consider a list of 5 numbers: [ICODE]3 5 7 8 9[/ICODE] So n … | |
Re: [QUOTE=RituNimitNayal;677370]Hi, How to find out the repeating substrings in a string which is having maximum characters. eg : abc abcd a abc abcd Answer : abcd[/QUOTE] I think I might know what you are asking, but I am not sure and thus it would only be a guess. Please phrase … | |
Re: You have to sort the elements based on their value of bid. Use any sorting algorithm you want. [Bubble sort](http://en.wikipedia.org/wiki/Bubble_sort) is fairly easy to code. I assume you have a way to compare two bids that is satisfactory to you? I notices bid is type CString. If the CString represents … | |
Re: [QUOTE=TTgheTT;677309]anyone can help me? please problem: write a program that creates three processes and performs matrix operations at the same time. each process performs a different matrix operation. the program reads three matrices from a text file. the size of the matrix can be of any valid size. use two-dimensional … | |
Re: [QUOTE=timb89;676124]heres wat ive done so far i can get it to display the txt file but im kinda cheating and doing it in a string which still works wat im not sure about tho is storing information in a text file into a 2d array so lost! [CODE=cplusplus]int main() { … | |
Re: [QUOTE=dmanw100;676638]I recently completed a small console app that accepts input from the user and places it in a floating point array, which was implemented through a for loop. I have not spent much time studying error handling and was wondering if anyone could refer me to a useful error-handling tutorial. … | |
Re: You've done a good job explaining what the problem is and when it occurs. It might be helpful, though, to post an exact input file that had a few examples of single authors and multiple authors. The exact input file is going to let us know what can be assumed … | |
Re: [QUOTE=mwg9119;676617]I guess I don't quite understand what you are saying. Here is what I got. I can't get it to tell me the next largest integer. It only copies the value from the largest integer.[/quote] [code=JAVA] int largest = 1; int nextlargest = 1; while (number != SENTINEL) { number … | |
Re: [QUOTE=floros;676516]Also there are 2 more errors for these: //set up an input stream ifstream input; input.open (imagefile, ifstream::in); error C2872: 'ifstream' : ambiguous symbol //open the output file ofstream output; output.open (outputfile, ofstream::out); 'ofstream' : ambiguous symbol[/QUOTE] Why don't you just use [ICODE]fstream[/ICODE] rather than [ICODE]fstream.h[/ICODE] , even if VS … | |
Re: I'm going for the beer machine. [url]http://www.iwantoneofthose.com/gorgeous-gifts/gifts-for-him/beer-machine/index.html[/url] I have a friend who's an extremely serious beermaker who spends every spare moment learning about pH levels, fermentation, etc., and it would be cool to buy this, see if it actually worked, and then give it to him as a birthday present. … | |
Re: I think Mojave is Windows Vista with Service Pack 1, so maybe they've fixed a bunch of bugs from the initial release and they want a clean slate. They're making it sound as if what they were showing people was the same as what they originally released and I don't … | |
Re: [QUOTE=ladyscoleman;675996]I was reading the GPA score thread but it didn't help me any. i am suppose to be making a program that should prompt the user to enter up to 30 GPA's which are stored in a single dimension array. each time the user enters a GPA they should have … | |
Re: [QUOTE=errorman;675795][code=language] #include <iostream> using namespace std ;char (name)[20]; int helps; void (checkOutVillage) (void); int main(void){ { std==cout << "Please Enter Your Name!" << std==endl; cin >> name; std==cout << "You Are On A Great Quest" << name; << std==endl; std==cout << "There Is A Small Village In Trouble. Should We … | |
Re: [QUOTE=sciwizeh;675244]I am working on a Matrix class that will eventually do a lot of stuff, but early on I have already hit a snag, how do I initialize (in a constructor) the 2D vector I have declared. [code=c++]//matrix class #ifndef MAT_CLASS #define MAT_CLASS //template <typename T> using namespace std; class … | |
Re: [QUOTE=jOhN_pRattZ;674451]hehehe why i know you can do this one hope you can help me as soon as possible and besides your a professor prove it pls i really need your help[/QUOTE] This post makes no sense. What exactly do you want other than someone to do the entire thing for … | |
Re: [QUOTE=FtKShadow;675170]Ok I have been working on a basic calculator for C++. The only problem is that I don't know how to make it so if you divide by 0 it couts something. Anyone help. I know it would be possible with if/else statement. Heres the code so far. [/quote] So … | |
Re: [url]http://www.daniweb.com/forums/thread90228.html[/url] [url]http://www.dreamincode.net/forums/showtopic30581.htm[/url] The above are two good threads that may be of interest to you that explain what is going on pretty well. Basically, you can add a second line of: [code] cin.get(); [/code] in lieu of the [ICODE]system("PAUSE");[/ICODE] command, which works but is frowned on because it makes a … | |
Re: [code] EndLabel[0] = getParameter("[COLOR="Red"]Label[/COLOR]1"); EndLabel[1] = getParameter("[COLOR="Red"]Label[/COLOR]2"); EndLabel[2] = getParameter("[COLOR="Red"]Label[/COLOR]3"); EndLabel[3] = getParameter("[COLOR="Red"]Label[/COLOR]4"); [/code] [code] <PARAM NAME="[COLOR="Red"]EndLabel[/COLOR]1" VALUE="110"> <PARAM NAME="[COLOR="Red"]EndLabel[/COLOR]2" VALUE="150"> <PARAM NAME="[COLOR="Red"]EndLabel[/COLOR]3" VALUE="100"> <PARAM NAME="[COLOR="Red"]EndLabel[/COLOR]4" VALUE="170"> [/code] You have getParameter looking for the parameter that goes with "Label1", etc. rather than "EndLabel1", etc. | |
Re: One, you've made your StackClass class public, so it needs to be in a file called StackClass.java. Two, you refer to some classes called IntElement and DataElement, but don't provide them. There are a few more errors in there, I think, but fixing those will get rid of a bunch … | |
Re: [QUOTE=GrimJack;673733]This [URL="http://www.seemerot.com/"]site[/URL] is just EEEEeeeewwwwww! <<[COLOR="Red"]blush[/COLOR]>> I have actually been checking in occasionally over the last 3 or 4 years and did not see much change.[/QUOTE] This woman looks very good for being dead for three or four years. I'm no expert on dead bodies, but I think there should … |
The End.