581 Posted Topics
Re: Syntactically your code is alright , but there is a logical error that you will have to figure out. The basic algorithm would be like this Take a value from the x List. then check if the value is present in [COLOR="Green"]all[/COLOR] the array-spaces in the new_array. If it is … | |
Re: I am not sure about this , But does this happen because all of the global elements are constructed only at the start of main ? | |
Re: This is how we can sum up the whole Pattern ... See that the 1st line starts up with the first and last space filled with a '*' And Then in the second line.there is an increment at the left side by one, and on the other side you have … | |
Re: Do you mind posting the code. So that we can check it out ? | |
Re: It is not that you are creating 5 strings of size 35, But actually Creating an 2-d array of 5 rows and 35 columns. The size of the string is not constant and can extend as much as possible ,until you have the "space" to store such a long string. | |
Re: FIrstly Please Donot Send PM'S asking for people to solve your problem. There are high chances that many will just Ignore your problem and you will not even get suggestions to your problem. [COLOR="Red"]The proof of your PM[/COLOR] [QUOTE=Supercharger][B]Sorry for the random message. But would you care to help me … | |
Re: Next time use CODE TAGS!! The First thing is that you might be using a very old compiler to compile your code. this is evident from [icode]#include <iostream.h>[/icode] but asides that , I see that you have not implemented a sorting function in the first place. Consider this : Firstly … | |
Re: >>what id i swap the num-- to --num what will that do?? -- is the decrement operator. The Basic function of the Decrement operator is to decrease the value of the variable by 1.Thats pretty simple right. However Decrement/Increment can be used in two methods they are [b] Prefix [/b] … | |
Re: Well , if you have started C++ right now , It would be hard to understand what [ICODE] int main () [/icode] stands for, Most books explain the code as the place where the execution of the program begins. And I tend to prefer it to be that way, until … | |
Re: [QUOTE=Hiroshe;934825]It's a stratagy to make your teachers stop asking you questions. :P I kinda wrote it as I was looking it up so it ended up slightly longer than I thought. Also didn't notice the scroll bar shrinking. Oww well :$[/QUOTE] I wonder what your essay would be like!!! ;) | |
Re: The main Problem in your code is that it replaces the letter "b" with the letter in UNICODE represented as "001A", which is the key to break the execution of the program. | |
Re: Anthony , Welcome to Daniweb. Firstly it is necessary that all the OLD THREADS in this forum remain DEAD. Hence it is not considered well to hijack a thread, secondly to hijack the thread whose last post was about 2 years old. Secondly the use of [noparse][CODE] [/code] [/noparse] tags … | |
Re: [url]http://www.cplusplus.com/reference/clibrary/cstdio/printf/[/url] This is a complete explaination of the printf function . you will notice that %x or %X is denoted to show the hexadecimal notation. Though I am unsure about being able to print out the binary value. | |
Re: < SNIPPED > AS I learnt it provided misleading steps to the OP. </SNIPPED > | |
Re: Well are the operations in your code. represented by a_1 , a_2, Different functions alltogether and is there anyway that we could represent a particular sub-process with a time constraint. If So you could always, Try a Shortest Time Notation which compares 2 stacks and looks to see which operation … | |
Re: Btw, You should also note that the Votes are CASE-SENSITIVE too. So you will need to check if CAPS-LOCK is on or else the votes would all go to VoteTo0. | |
Re: Hehe, I guess SALEM's Right As Always ;) Btw, For the OP, Here's a Tip that would help you out. Check out how "Pointers work." If you figure that out, I guess you will find that its absolutely unnecessary to use a member temp and Also recognise that you are … | |
Re: btw, if you are thinking of comparing a char type only and not a char string, ie: if keypressed is of type char. You should use ' instead of " as quotes | |
Re: Well, Sum to n terms is [tex] \frac{n*(n+1)}{2} [/tex] Where is the need for [tex]a/b[/tex] in your equation. Please Be a little more elaborate so that we can understand what exactly is your aim. | |
Re: I think you will basically need a square matrix, ie: no. of columns = no. of rows. then, You could do somthing like this Well the recursive function might be applied on only the last row. you could say somthing like val(x,y)=val(x-1,y-1)+val(x-1,y); This would be the function which should end … | |
Re: Instead of checking whether the character is a alphabet. wouldn't isalpha do the trick ? | |
Re: >>zup pipz?? [B][COLOR="Red"]Voilation 1:[/COLOR]NO L33T TALK PLEASE!![/B] >>i want to create a anti virus using batch file.. Oh, Great, I hope you succeed in your attempt but one question... [COLOR="Green"]" How Is This Related to C++ ?"[/COLOR] Batch Files can be created with the help of a normal text editor … | |
Re: The function [icode] toupper[/icode] takes a character argument and returns a character. so you cant assign a string and expect to get back the string itself. You will have to replace every letter in the string with its equivallent.Upper case character. | |
Re: [code] if (n = 2) [/code]shoudnt this be [code] if (n == 2) [/code] | |
Re: Well, You know that the 3 x 3 Matrix could be solved by first element (2x2 Matrix,) -(2nd Element )* (2x2 ) Matix ................ The same applies to the NxN matrix on a large scale, All you have to do is to. (first element ) * (Det of (N-1) * … | |
Re: jempag, It is kinda hard for anyone, to predict your exact approach into writing a program to either encrypt or decrypt. Even if they are familiar with the cipher. Therefore, in order for you to get better suggestions I guess it would be compulsory for you to first take the … | |
Re: Are you sure if your code compiles, Its your 13th post and The Lack of Code Tags make this program a lot more messier. [code] for (i=0; i > 30;++) { array[i]=AccumalatedValue cout<<array[i]<<endl; {[COLOR="Red"] //Shouldnt this be '}'[/COLOR] [/code] And where is the ending Brace for the function itself. Apart … | |
Re: From the next post please use code tags. Well, By the code it seems like you have understood the usage of `Struct's` and How to handle `structs`. But you seem to have become confused upon something known as "**Scope or Resolution**". Consider the following Example. #include <iostream> using namespace std; … | |
Re: Well i compiled the program and it seems to work just fine. Are you sure, that the program crashes if INput is >4? | |
Re: Firstly It might be a mis-judgement that you choose C++ just because of the number of thread, Well The Language should actually be determined by looking at what you are going to program. And secondly, the experience you have in a particular programming language also counts. Apart from that, i … | |
Re: [code] else { array[i] = n-1; } [/code] Assigning n-1 is a problem, because n-1 might have already been present in the array. Instead , try to generate another random number for position 'i'. But the for loop increments the value of 'i' in the next iteration . Though I … | |
Re: Look at Line 52. [code=cpp] cout << center (title)<<endl; [/code] You are trying to send a void type to an outputstream. CODE LINE 26 is the proof of that. [code] void center(string const &str) [/code] Where as actually you donot need the [icode]cout[/icode] statements as the function implicitly uses cout … | |
Re: [code=cpp] m = momo.operation(3, 4, momo.addition); [/code] Try to send a reference of that function . [code=cpp] m = momo.operation(3, 4, &momo.addition);[/code] | |
Re: Well, I have a little trouble understanding your question. I just tested out your program.... By this i figure 2 things, 1. You want the computer to move exactly the number of squares specified by the user without any intervention. 2. You want the computer to stop moving if you … | |
Re: Well, Its quite simple, Use the same formula that you have in the existing code, But just change all the instances of '5' with a variable. For Eg: [code] for(i=1; i<=5; i++)[/code] This could be something like/ [code] int len=5; for (i=1;i<=len;i++)[/code] Now you will then need to further need … | |
Re: I think that we might basically sort your array according to the length of the word. Then The Binary Search Would get you to one of the bounds of the SearchList containing the same length, Then I guess You can take in the corresponding letters and compare to their equivallents, … | |
Re: I think it would work if you could change this [code] a->pVar=static_cast<int*>(passedVar); [/code] to [code] static_cast<int*>(a->pVar)=static_cast<int*>(passedVar);[/code] The error you get is because you are trying to make a void pointer refer to a int pointer (Because the cast makes the void pointer to passedVar behave like an int*) So please … | |
Re: Well there is the use of a typedef. [code] typedef void (*func_int) (int); //This would make the pointer to function accessible by the name func_int void func (func_int func name); //YOu can use that as a parameter { func_int varname = &name;// And Create new objects :) } [/code] | |
Re: [QUOTE=adatapost;951518]the great, study this thread - [URL="http://www.daniweb.com/forums/thread78955.html"]void main vs int main [/URL] >I am unable to change the program. Can any one help? I am really in need of it.... Use two dim. character array and put asterisks '*' and spaces.[/QUOTE] Yes, this is prettymuch the best way to do … | |
Re: [quote] its impossible to just pass a, b and not c ?*/[/quote] Not necessaryly. Well another alternative would be to give default values to your arguments for eg: [code] void funcname(int a, int b=0, int c=0); [/code] Now i can just call the function in these 3 manners for eg: … | |
Re: SO you have 2 patients with the same doctor. Though it is not impossible , it is quite tedious to do so especially during runtime, Not only that it requires some over head to do so during runtime . Your basic approach would be to generate and store a list … | |
Re: These questions are actually not C++ questions, they are mainly logical, Infact, The C++ constraints come in only during the use of compound assignments operators, ie: ( +=, -= ,/= etc..) So , Just think over the questions, And I GUESS you will get to the answer easily . | |
Re: Hey a better way would be to delete the particular letter in the string after you encounter it. using the [icode]string::erase()[/icode] function. In the end you will have to just chek if the string is empty(); and then you have a anagram. | |
Re: Well , Mr Stroustrup's book "The C++ Programming Language " would give you much insight on the language. keeping in mind that you are already familiar to OOPS it would be worth the effort of reading such a book :) | |
Re: [code] inpa >>(name)>> (visit_duration) >> doctor;[/code] your doctor class does not have a [icode]>>[/icode] operator overloaded, hence the compiler places that error. You can either define the operator, or change the value of doctor through temporary objects and the doctor classes functions. | |
Re: Lol sometimes you use "VISUAL C" and in other cases "VISUAL C++" which one are you using ? | |
Re: Well, You have misunderstood the basic concept of a [icode]class[/icode] [code] Employee Name[3] ={ "Susan Meyer", "Mark Jones", "Joy Rogers"}; Employee Idnumber[3] ={ 47899, 39119,81774}; Employee Department[3] = { "Accounting", "IT", "Manufacturing"}; Employee Position[3] = {"Vice President", "Programmer", "Engineer"}; [/code] So by this code you are actually creating about 12 … | |
Re: Put in all the cpp files into the Project and leave the header files in the current directory. and then compile | |
Re: I guess it is just a question of grouping. The Basic Approach would be like this: First you will need to start with sorting the "X" coordinates. After that. Group all the Objects having the same "X" coordinate. After that. In that particular group ... Sort the "Y" coordinates. | |
Re: [code] myfile.write << name << "\n" << home << "\n" << mobile << "\n" << adress0; myfile.write << "\n" << postcode << "\n" << email << "\n" << notes; myfile.close(); { else cout << "Unable to open file"; return 0; } [/code] Remove the [icode].write[/icode] and then try the program. … |
The End.