581 Posted Topics
Re: Dont You Think it is giving you the wrong answer? | |
Re: And Secondly. Why dont you just search for the word Matrix in Your File? [code] string inName[3],inChar[3]; while(in.eof()) string s; in>>s; if(s=="matrix") { for (int i= 0; i<3; i++) { in >> inName[i] >> inChar[i]; } break; } else //Do nothing } [/code] That way You will read the next … | |
Re: Please Post Your Code That you have worked on and then we can tell you whats wrong. You say that you have tried, So you will need to show the effort that you have put in, | |
Re: Or, you can use 2 pointers pointing to the first and last element of the list and then increment 1 and decrement the other. Until we get to the centre of the list . then delete that particular node(s) This way we dont count or, know how many elments we … | |
Re: First of all, A lot of people on the internet have a problem when they read in red coloured text. So i prefer you use [CODE] Tags... Secondly, are declaring 3 variables (of your class) and then running a separate function on each of them. As far as time comes … | |
Re: Though it is not preffered. You can declare mean as a global variable. So that you can get your program to work Just by snipping out the declarations and the return statement. | |
Re: Well You take in the data from the user and then again change it back....... With the strcopy(arg1,arg2) Function in main . | |
Re: I would also prefer that you use c++ based console in and out mechanisms. [code] printf () [/code] You should consider using [code] cout<< [/code] | |
Re: Well You can use the sort function to list and get the max value . For that you will need to write a bool comp() function for your datatype. Comparison function that, taking two values of the same type than those contained in the list object, returns true if the … | |
Re: Well Why Dont you try implementing them . | |
Re: Well , [code=cplusplus] myClass var3=var2+4; [/code] This will work fine only if you provide a constructor taking an int argument or if you write down the operator+ to take in an int. [CODE] myClass var3=4+var2;[/CODE] This will work i guess only if you provide a constructor. But if you are … | |
Re: Why Dont you embed the mirror function into the inorder fuction. Or else you can try to create three functions , 1)Inorder 2)Mirror 3)Inorderandmirror(); Basically i dont understand why you cannot call the mirror function through inorder. I think that it would be useful if you provide the code on … | |
Re: I think it is better for you to use a vector You Use A Vector to store in all the strings in your string. This pretty much acts like an array. So you will not be having much problems with it i guess [CODE] vector<string>numbers; string temp; while(!infile.eof()){ infile>>temp; numbers.push_back(temp); … | |
Re: I dont get it . When the person asks for a clue, You tell him to give the password first. And when he trys to type in a password you ask whether you need any clue. That gets the user nowhere. I recommend that you devise a small flowchart on … | |
Re: Well You should first implement a template with member function declarations and then you can [code] T& Array<T>:: applyThisWorks(Matrix<T> &m){ Array<T> retA(m.x()); for (int i=0;i<m.x();i++){ Array<T> r = getrow(m,i); retA(i) = sum(r); } return retA; } [/code] I am not a expert on this as i am still learning templates … | |
Re: I dont find any reason on why return *this is present there. If it had to be there it should have been like this. [code] class ThreeD { int x,y,z; public: ThreeD() {x=y=z=0;} ThreeD(int i, int j, int k) {x=i; this ->y =j; z=k;} ThreeD operator+(ThreeD op2); ThreeD& operator=(ThreeD op2);//It … | |
Re: Or Else Generate 3 Random numbers and then compare if they are equal or not . You can define 3 variables to hold the numbers and then use if (Statement) to get a true or false. based upon which you can give out a result. | |
Re: Well if you include that function in a header inside namespace std It will work. Something like [code] namespace std { remove() { //Func goes here } } [/code] And save that file, Dont forget to include the file when you try to use that function. if remove.h is the … | |
Re: What VernonDozier meant was to remove variable "i" from your code and introduce another variable [code] void countPassing(double grades[]) { int a; a=0; for (int i=0; i<numofgrades; i++) { if (grades[numofgrades] > 59) a++; cout<<a<<"out of "<<numofgrades<<" passed the test"<<endl; } [/code] And secondly ,remove all the "cout" statements out … | |
Re: If You have No restrictions on editing your file, i guess you can write something like a single letter in the starting of the document, something like a single digit, {0,1} Then in your program [code] int main() { //Code to open file..... //Then check if (filein[0]='0')//Here "filein" is the … | |
Re: I went through the problem, And i think there is a problem with the conversion on the last number [code] for(i=0; i < a.length(); i++){ //converts a char to an int value = a[i] - '0'; store[i] = value; [/code] observe the for loop. try changing it to [code] for(i=0; … | |
Re: Well i would have loved to help , But i find myself stuck. I get only 22 different 3 letter permutations with my recrusive function and i am still working on to see what went wrong? [code=cplusplus] #include <iostream> #include <string> using namespace std; class permutation { public: string inval; … | |
Re: I guess the textbook asking that question will have your "great" answers. Just read !! | |
Re: First of all, You dint post out any question, And secondly, while you post in the question, Please post in where you are having problems with your code. | |
Re: [QUOTE=nizbit;689842]I was wondering if this code is correct syntax for function parameters in a class? [CODE] class myclass { private: char mystring[50]; int length(char string[]); public: int yourlen(){ return length(_string, _string); [/CODE] I know later in my code, I would have something like this: [CODE] mystring A; char string[50], string2[50]; … | |
Re: I guess it is quite simple, You can use an array for rock paper and scissors, Then try to generate a random number, After a random number is got, you can use the modulo operator to get the remainder after dividing by 3, So then you get the computers choice, … | |
Re: Hey something funny just crept up when i was reading the question [quote] * Another Special! How ever many oranges you buy will give you the same number of percentage off your total bill. (If you buy 10 oranges you get 10% off your total bill.) (For now, ask the … | |
Re: This forums doesnt do your homework [URL="http://www.daniweb.com/forums/announcement8-2.html"]Please Read This.[/URL], We give help to people who are having problems working out thier code. Please post in what you have come up with until now and we will be happy to help | |
Re: And another thing [CODE] void main () {} [/code] In many new c++ compilers is not acceptable.because it is deprecated or something . I prefer that you use [code] int main () {} [/code] | |
Re: And Shamila , Instead of printf and scanf i prefer you use functions like cin and cout int the namespace std; | |
Re: Hey, I dont seem to see any other method than this one. Is there anything wrong with the solution ? | |
Re: Where is the quicksort function mentioned in the code that you have posted? | |
Re: First Of All , Please Use Code Tags and Secondly . Specify your Problem And a Tip: Stop using the same names to both pointers and arrays of the same type. | |
Re: I am not sure but !! I think you will first need to convert the return type of the size type to int. try using the following instead. [code]cout<<"size of listName = "<<(int)listName.size()<<endl;[/code] This happens because list::size returns a size_type variable where as you will need an int i guess. | |
Re: Do you need to take in the input from the user ? And store those values into a file ? Or Do you need to read from a file and then again put the same back into the file ? Please Specify. | |
Re: Well No Wonder You are getting errors. This is because you have declared a void function and giving a return value to it. | |
Re: You should have used google to search it over. But however here is a small explanation get basically takes in one character from a particular input stream that you have used it with. For Example [CODE] char a = cin.get(); [/code] The above statement takes in a character that a … | |
Re: Well , Abhi According to the Question That You are asking. You need the computer to determine the a sequence from user input. This is not definable as the user may type in anything . If thats not the case and you are given an arithmetic progression when 2 numbers … | |
Re: Lol, Well This is a forum which helps people who show help. But you just cant give in your homework and expect anyone to help you out. When you donot show any effort. | |
Re: In the function inword() , i dont understand why you are creating new vector words and a character variable guess. Instead of doing that. Pass them as arguments for the function or declare them globally and dont declare them again in the function itself. | |
Re: Well you can use a character Array Of 27. And then assign an alphabet to each of them. And then you can get input from the user and write a find function for finding letter. After you can find the letter store it in one place. =========== Take the first … | |
Re: Yes , If you are using Windows As An OS. YOU CAN TRY [code] system(cls); [/code] To Clear the whole thing up and then a printer function added in. | |
Re: You can start by defining your struct and posting down the code you have come up with until now. Please Read This too: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: What is the error what you get and what compiler are you using. | |
Re: Shouldnt You Be Using "||" For OR. I mean [code] if((argv[i] == "-h" | argv[i] == "--help" ) && help != 1) [/code] Should Be Actually [code] if((argv[i] == "-h" || argv[i] == "--help" ) && help != 1) [/code] Right. | |
Re: Well You can manually Implement You own Function. [code] void display (stack& s) { for (int x=0; x <s.top;x++) { std::cout <<s.values[x]<<"\n"; } [/code] This is for external stack displaying. you can write a class function that will do the same without taking any argument. | |
Re: Is Your member a type FlightTl and i dont see any Declaration of a Flight type for acessing it. Secondly , I dont know perfectly on this matter but i think that only a static class member can be a member of the same class . CODEBLOCKS GIVES THIS A … | |
Re: Hey, I remeber a way which can generate changing random numebers but i donot know that if it works properly coz i pretty much forgot that code a long while ago.. The Only Backdrop is that it needs a user input to stop changing random numbers.. [CODE=CPLUSPLUS] #include <iostream> using … |
The End.