1,171 Posted Topics
Re: You forgot the end brace: [ICODE]if (s1.at(i) == s2.substr(s2.length()-i-1,1)[COLOR="Red"][B])[/B][/COLOR][/ICODE] >pretty sure my logic is right? No, I would have used [ICODE]if (s1.at(i) == s2[i])[/ICODE] instead of the above :) | |
Re: From [URL="http://www.daniweb.com/forums/thread110620.html"]this[/URL] thread I would suggest you to use: [ICODE][B]unsigned long long[/B][/ICODE] :) >can long long store 12 digit numbers. Depends on what your compiler is... | |
Re: Write it as: [ICODE](n->d).day[/ICODE], the '[B].[/B]' operator precedes the arrow operator in expressions :) | |
Re: To the OP: [LIST=1] [*]> // paste code here We aren't going to post free code for you, however we can help you to accomplish the more tricky parts, give us a thorough problem description (not just: My program doesn't work, can you fix it for me?) [*]We're not code … | |
Re: >all is well but i do not have that "OTHER PROJECT TYPES " That's because you're probably using an Express Edition, there are no Setup and Deployment Projects in the Express Editions... >i beleive that windows vista could be part of the problem No, certainly not, Visual Studio 2008 was … | |
Re: Consider this: [CODE] char *pointers[2]; char array[2]; pointers[0] = &array[0]; [/CODE] | |
Re: Pavan, would you mind to post [URL="http://www.daniweb.com/forums/misc-explaincode.html"]using code tags[/URL]? >is negative subscript of array allowed in C? No, though you can achieve something like that by using pointer arithmetic, it can be very dangerous to do: [CODE] [COLOR="Red"][B]// This is completely wrong and very dangerous![/B] int array[20] = {0}; int … | |
Re: There's [B]a name conflict[/B] between the object 'movie' (which you created from your struct) and between your function movie: I corrected the code by changing the name 'movie' to 'movies' for every instance of DVD: [CODE] [COLOR="Green"]/* I've also changed your include directives */[/COLOR] [COLOR="Green"] #include <iostream> #include <string> #include … | |
Re: [QUOTE=Pavan_;885494]At which line declaration and statement are mixing?[/QUOTE] [U]Describing the problem:[/U] Take a look at this: [CODE] [COLOR="Green"]int i,j; float H [100][100]; FILE*in;[/COLOR] [COLOR="Red"][B]in=fopen("0.txt","rt");[/B][/COLOR] [B]// you make an assignment here (1)[/B] FILE*out; out=fopen("rotation0.txt","w"); [/CODE] [B](1)[/B]: In C89 you aren't allowed to declare any more variables after the first statement (and … | |
Re: [QUOTE=csurfer;885568]Take input in an char array and ......[/QUOTE] To mention: a char array is not the only possibility, using a string is also possible :) | |
Re: [QUOTE=Pavan_;885522]if u are asked to implement a stack then what u prefer?[/QUOTE] I'd go for something like [URL="http://www.friedspace.com/cprogramming/stacks.php"]this[/URL] :) (a stack based on a linked list) | |
Re: [QUOTE=trickx0729;884406]Hey guys, [INDENT]I just want to know if its possible to code a java program that will automatically logs you on your online accounts (e.g. such as yahoo mail, facebook, gmail, multiply, or even in this site) using your own username and password you use to register on such accounts. … | |
Re: >try placing it directly in the video memory(0x40000000) Haha, directly! I assume the OP isn't using DOS anymore :P | |
Re: What do you actually want to achieve using an USB port? Your question was very vague... Do you want to write some files to a USB stick? Do you want to transfer data over a USB cable? Do you want to control a wireless USB adapter? USB has much applications … | |
Re: > Dear you are declaring a char ( char s1 = "" ). Its not a string fis=rst declare a string as > `char s1[10]; // string s1 of 10 characters` > `char s2[10]; //string s2 of 10 characters` > Now take input as > `cin.getline(s1,10,'\n');` > `cin.getlin(s2,10,'\n');` > Now … | |
Re: [B] >Im New To c++, But Not New To Programming >What Iz The Point Of A Array? [/B] Haha! And you don't know the assets of an array? Imagine you're a teacher and you've to write a program which deals with the pupils' scores, let's say you've twenty pupils in … | |
Re: [QUOTE=ArkM;880062]Better try to read this forum rules before 6th of June: [url]http://www.daniweb.com/forums/announcement8-2.html[/url][/QUOTE] Yes, and read [B][URL="http://www.daniweb.com/forums/misc-explaincode.html"]this[/URL][/B] as well :) And when you think you know the forum rules, you can come back, deal? | |
Re: [ICODE]main()[/ICODE], this is not C++ ! In C++ it would look like: [ICODE]int main()[/ICODE] :) | |
Re: >Write a C++ program that ...... No, [B]YOU[/B] write it! BTW, [URL="http://www.daniweb.com/forums/thread78223.html"]Read this before posting[/URL] :) | |
Re: Hi, siddhant3s, I think it would be more helpful to the OP if you indent your code, there's a nice article about code indenting available [URL="http://www.gidnetwork.com/b-38.html"]here[/URL] :) | |
Re: >If You Want Something To Do Yes, I want to give you some links you should consider looking at before you start posting on this forum: [URL="http://www.daniweb.com/forums/thread78223.html"]Read this [B]before[/B] posting[/URL] [URL="http://www.daniweb.com/forums/announcement8-2.html"]Forum announcement I[/URL] [URL="http://www.daniweb.com/forums/announcement8-3.html"]Forum announcement II[/URL] Come back when you've read them :) (It will take you a couple of … | |
Re: First read [URL="http://www.daniweb.com/forums/thread78223.html"]this[/URL], then you read [URL="http://www.daniweb.com/forums/misc-explaincode.html"]this[/URL]. After that you change your code to use new-style headers, and then we're ready to help you :) Change [CODE] #include<iostream.h> #include<stdlib.h> [/CODE] to [CODE] #include<iostream> #include<cstdlib> [/CODE] (if your compiler supports it, if your compiler applies to the C++ standard, then this … | |
Re: IMO (= In my opinion) (yea killdude, it's an opinion) you shouldn't use WinAPI for Graphics Programming, it's unportable (as already said by siddhant3s), and there are a lot of better and easier to learn Graphic/GUI Libraries available for cross-platform development, if you write your program, making use of such … | |
Re: [QUOTE=p2009_d;882459]Can u please tell me how to do nesting of arrays of structures[/QUOTE] What?? Edit:: Your (unformatted) code looks much more like C than like C++ ! | |
Re: >Can someone help me to make a program in java Yes we can help you, please post the code you have so far ([URL="http://www.daniweb.com/forums/announcement8-3.html"][B]read this[/B][/URL]) and tell us where exactly you're having problems with. | |
Re: [QUOTE=anydam;877457]Not really, I am a beginner of C. could you tell me more about that?[/QUOTE] Take a look at [URL="http://publications.gbdirect.co.uk/c_book/chapter10/arguments_to_main.html"]this[/URL] web page :) | |
Re: [QUOTE=Ancient Dragon;879855]what is SDL ? [/QUOTE] SDL is a cross-platform multimedia library for C++. Take a look here: [URL="http://www.libsdl.org/"]http://www.libsdl.org/[/URL] :) | |
Re: >i dunnu how to do it which is change negative variables to positive ones?? I think you mean the 'absolute value', take a look at this: [CODE=C++] int a = -5; // a contains a negative value a = abs(a); // a now contains 5 instead of -5 [/CODE] >but … | |
Re: >Can sumone suggest me the easiest way to do it. I think [B]piping[/B] is the easiest way to do that :) ( No need for [ICODE][B]fopen()[/B][/ICODE] :P ) Note:: Not all platforms support piping, though as far as I know Windows, Linux and Unix are all supporting it... ( But … | |
Re: [ICODE][COLOR="Red"][B]void main()[/B][/COLOR][/ICODE] is evil, make it [ICODE][B][COLOR="Green"]int main()[/COLOR][/B][/ICODE] ([URL="http://www.gidnetwork.com/b-66.html"]read this[/URL]) [COLOR="Red"][B][ICODE]#include <conio.h>[/ICODE][/B][/COLOR] remember that conio isn't a part of the standard C library :) BTW, Why don't you use a [URL="http://www.cprogramming.com/tutorial/lesson5.html"]switch statement[/URL] for this? Edit:: To the OP: Do you want to pause your program? Then take a look at … | |
Re: You should use [B][ICODE]break;[/ICODE][/B] instead of that exit command :) | |
Re: [QUOTE=vs.vaidyanathan;880859]What does error Lnk 2001 and LNK 1120 mean? Am a complete noob.. Could anyone please give me a step by step procedure to rectify it?[/QUOTE] How are we supposed to know this? We even don't know what compiler you're using :( (we need to know this because it can … | |
Re: Aaaaaaaaaaargh! [ICODE][B]void main()[/B][/ICODE], don't use it, [B]it's evil[/B] (check [B][URL="http://www.gidnetwork.com/b-66.html"]this[/URL][/B] page) !! Use [ICODE]int main()[/ICODE] instead :) You should also read [B][URL="http://www.gidnetwork.com/b-38.html"]this[/URL][/B]. A comment like this: [ICODE][B]//variable decl of float type[/B][/ICODE] makes no sense, everyone can see that the declared variables are of type float. [B][U]Note::[/U][/B] This code looks more … | |
Re: I get tired of saying it: why does anyone use [ICODE][COLOR="Red"][B]system("PAUSE");[/B][/COLOR][/ICODE] ?? Isn't [ICODE][B][COLOR="Green"]cin.get()[/COLOR][/B][/ICODE] good enough? Is it maybe too fast ?? BTW, Take a look at my signature as well! Edit:: And at [URL="http://www.gidnetwork.com/b-43.html"]this[/URL] :) | |
Re: >have recently upgraded from Allegro 4.2 to Allegro 5 Actually you aren't using Allegro 5 yet, you're using a Work-In-Progress (WIP) release for the future Allegro 5.0 branch :) So I don't know whether this Allegro is already finished yet, I personally think it isn't. >In Al 4.2 I could … | |
Re: > A simple voice chat program is just a program which sends sound over a network from one side to another side so I guess you'll probably need at least two things: >>> A network library >>> A library which deals with sound | |
Re: [COLOR="Red"][B]Unportable code alarm![/B][/COLOR] You're including [B]conio.h[/B], this isn't a standard library file iostream.h is not a C header, it's a C++ header, so you posted your code in the wrong forum Aaargh, the terrible [COLOR="Red"][B][ICODE]void main()[/ICODE][/B][/COLOR], it's evil, replace it with [COLOR="Green"][B][ICODE]int main()[/ICODE][/B][/COLOR] (read [B][URL="http://www.gidnetwork.com/b-66.html"]this[/URL][/B]). This is not C code, … | |
Re: Take a look at the corrected code and at Ahmed_I's post :) [CODE] #include <iostream> using namespace std; int main () { int faq_choice; [COLOR="Green"][B]char faq_YN;[/B][/COLOR] cout << "\t\t\t ================= "<<endl; cout << "\t\t\t || || || || "<<endl; cout << "\t\t\t || || || || "<<endl; cout << "\t\t\t … | |
Re: Replace [ICODE]char password;[/ICODE] with [ICODE]char password[31]; [/ICODE] And change [ICODE]cin >> password;[/ICODE] to [ICODE]cin.getline(password, 30);[/ICODE] If you declare [B]password[/B] like [B]char password[/B] then you tell your compiler to reserve memory for one character only, but we want a set of characters (a string, an array of characters), so we write … | |
Re: First some remarks on the OP's code: Use new-style headers if possible, so: [CODE]#include <iostream.h> #include <stdlib.h> #include <fstream.h> [/CODE] would become [CODE] #include <iostream> #include <[B]c[/B]stdlib> #include <fstream> [/CODE] Avoid the use of [ICODE]system("pause");[/ICODE] (look in my signature, for a replacement and the reason on why to avoid it) … | |
Re: [QUOTE=Tux Shakespeare] Apples are red, The sky is blue, If he posted using code tags I was happier too. [/QUOTE] :P | |
Re: Read all the names into a vector and use the [B][URL="http://www.cplusplus.com/reference/algorithm/sort/"]sort[/URL][/B] algorithm to sort them alphabetically :) You could also sort it by using the [B][URL="http://www.cplusplus.com/reference/clibrary/cstring/strcmp/"]strcmp[/URL][/B] function if vectors aren't allowed. If both of them aren't allowed then you'll have to implement a sorting function first (you could take a … | |
Re: A password program which is only accepting passwords which consist out of one character is not a bad coding practice, but it's a bad security practice :) | |
Re: >The compiler say "Link error" and ... And what? Could you please post the whole error message (plus code), and what's [B]Array[/B] ? | |
Re: Took from the php manual: [QUOTE]Note: When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini. Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in … | |
Re: [QUOTE=sifah;879543]i want to validate the String entered wether it is a valid standard equation of [COLOR="Green"]conics[/COLOR] the standard equation is: ax^2+by^2+2hxy+2gx+2fy+c=0 some variables can be missed in input string but it should be of "degree 2" equation[/QUOTE] Do you mean a quadratic equation like this: [B][ICODE]ax^2 + bx + c[/ICODE][/B] … | |
Re: [QUOTE=mirfan00;879491]1) [COLOR="Red"][B]int arrA[];[/B][/COLOR] int *ptrToarrA = arrA; 2) [COLOR="Red"][B]int arrB[];[/B][/COLOR] int *ptrToarrB = arrB; Now it is correct. When you enter a value in the array it store in *ptrToarrB and if you want to enter more values in the array you run a for or while loop for this … | |
Re: Create a vector of type [B]wchar_t[/B] and store the values in it :) Remember that you'll have to use [B]wcin[/B] and [B]wcout[/B] if you want to do I/O | |
Re: I have no clue what you mean... Could you demonstrate the expected output using an example? | |
Re: It's probably better to make the following variables [B]private[/B] in your [B][ICODE]struct[/ICODE][/B] (as you have already input/output functions): [CODE] int ID; int salary; int division_code; int job_code; [/CODE] Every data member of a struct is made public by default, however you could use the data access specifiers to encapsulate some … |
The End.