2,384 Posted Topics
Re: It's telling you to look at this.[code]void initialise(float&, [COLOR="Blue"]double[/COLOR]& ,int& ,int& ,bool&); float controlTotal; [COLOR="Magenta"]float invoiceTotal[/COLOR]; [COLOR="DarkOrange"]/[/COLOR]*********[COLOR="DarkOrange"]/[/COLOR]initialise (controlTotal, [COLOR="Magenta"]invoiceTotal[/COLOR], pageCount, lineCount, more);[/code]Incidentally, using comments would allow me to run it into a compiler without editing it. Favors such as this (not requiring others to edit out what is not actually … | |
Re: [url]http://en.wikipedia.org/wiki/Exception_handling[/url] [url]http://parashift.com/c++-faq-lite/exceptions.html[/url] Your textbook? | |
Re: My first bit of advice would be to clean it up a little first. [quote]PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: test.c (C) test.c 10 [Info 734] Loss of precision (assignment) (31 bits to 7 bits) test.c 22 [Warning 534] Ignoring return value of function … ![]() | |
Re: [QUOTE=nanodano]I found a solution! Simply force type-cast it as an int. [code] switch(int(hello)) [/code][/QUOTE]That's not a solution, that's just hiding a problem. Solutions were already presented. | |
Re: >Why does it print double the first time? Because you type Y and then [Enter]. The Y is consumed by the cin, and the newline is left in the input buffer. This satisfies the first call to getline -- needing no input from you. In general, take all input as … | |
Re: I'd recommend backing up a little and first learning [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044841143&id=1043284376]how to declare main[/url], [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044652485&id=1043284385]how to obtain strings[/url], and [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043372399&id=1043284385]how to obtain numbers[/url]. An array of size N may be indexed from 0 to N-1. | |
Re: The code you posted does not compile because it does contain errors. I can better help if you copy and paste what you really have. C++ is case-sensitive, so I and i are different. You're using pre-standard (non-standard) C++ ([INLINECODE]# include <iostream.h>[/INLINECODE]). [code]for (I=1; I<=5; I++){[/code]Arrays are zero-base, so this … | |
Re: You don't have a default constructor for Button. Also:[code]ButtonSet[i] = new Button(1, 0);[/code]You need a pointer with new. | |
Re: Try to rewrite it without the recursion of [INLINECODE]getDeltaT[/INLINECODE] calling [INLINECODE]getLines[/INLINECODE] and vice-versa. | |
Re: >You should have waited the full two YEARS before bumping this thread Didn't even notice that.:o How about we close this. | |
Re: How about single quotes for characters ([INLINECODE]'?'[/INLINECODE], [INLINECODE]'.'[/INLINECODE], [INLINECODE]'!'[/INLINECODE])? | |
Re: [QUOTE=Asif_NSU]LOL, when did statements like "this [B]could[/B] very well be a bug with gcc" requires "huge amount of proof".[/QUOTE]For quite a long time, actually. [url]http://www.catb.org/~esr/faqs/smart-questions.html#id264997[/url] [QUOTE=Asif_NSU]As for the format specifier %lf for printf() i don't think it's an issue with MinGW gcc [/QUOTE]The general rule of thumb is this: once … | |
Re: [QUOTE]1) What is top-down approach(POP) and bottom-up approach(OOP) and the difference between them..[/QUOTE][url]http://en.wikipedia.org/wiki/Top-down[/url] [quote]2) Different types of containership[/QUOTE][url]http://en.wikipedia.org/wiki/Container_class[/url] [url]http://en.wikipedia.org/wiki/Abstract_data_type[/url] [url]http://en.wikipedia.org/wiki/Standard_Template_Library#Containers[/url] | |
Re: Dry definition of FILE: [quote]an object type capable of recording all the information needed to control a stream, including its file position indicator, a pointer to its associated buffer (if any), an [I]error indicator[/I] that records whether a read/write error has occurred, and an [I]end-of-file indicator[/I] that records whether the … | |
Re: Nit:[QUOTE=Ancient Dragon][code][COLOR="Magenta"]array[/COLOR] = (char **)realloc([COLOR="Magenta"]array[/COLOR], array_size ); [COLOR="Magenta"]counts[/COLOR] = (int *)realloc([COLOR="Magenta"]counts[/COLOR],array_size);[/code][/QUOTE] [url]http://cboard.cprogramming.com/showthread.php?p=367853#post367853[/url] | |
Re: >char m[6]; 'm' is an array of of 6 characters. >int *rip[10]; 'rip' is an array of 10 pointers to int >struct george *c[6]; 'c' is an array of 6 pointers to objects of type 'struct george' >struct mike BigDeal(char *); 'BigDeal' is a function taking a pointer to char … | |
Re: [code] for (i = [COLOR="Blue"]0[/COLOR]; i [COLOR="Blue"]<[/COLOR] MAXELS; i++)[/code] | |
Re: If there have been no responses for say, a week or so, consider the thread dead and do not resurrect it. If you must post, then link to the thread in a new thread of your own. | |
Re: [QUOTE=anastacia]BUT IT IS SUPPOSED TO WORK ON ANY VERSION OF C++.[/QUOTE]NO, IT ISN'T. [QUOTE=anastacia]BY THE WAY CAN ANYBODY TELL WATS THIS DEV C++. IS IT ANY DIFFERENT FROM TURBO OR BORLAND C++ :lol:[/QUOTE][URL=http://www.bloodshed.net/devcpp.html]HTTP://WWW.BLOODSHED.NET/DEVCPP.HTML[/URL] [url=http://www.catb.org/~esr/faqs/smart-questions.html#writewell]DON'T TYPE IN ALL CAPS[/url]. | |
Re: [QUOTE=Ancient Dragon]the unsigned char data type has a range of 0 to (and including) 255.[/QUOTE]The unsigned char type has exactly the range of 0 to (and including) UCHAR_MAX. UCHAR_MAX may be 255, or it may not. When in doubt, why not be exact? | |
Re: Depending on how the variable being passed to the function is declared... [code] Person guy, gal[10]; set_owner(&guy); set_owner(gal); set_owner(&gal[4]);[/code] | |
Re: [code]void reversesort(int x[], int n) { int temp,i,j; for ( i=0;i<n;i++ ) for ( j=[COLOR="Blue"][B]i[/B][/COLOR];j<n;j++ )[/code]Also[code] int max=[COLOR="Blue"]20[/COLOR];[/code]And[code]for ( i=0;i<[COLOR="Blue"]max[/COLOR];i++ )[/code](The first loop in main.) Or, something like this. [code]#include <iostream> #include <cstdlib> #include <cstddef> using namespace std; void sortit(int x[], int n) { int temp, i, j; for ( … | |
Re: [code]Access violation reading location [COLOR="Magenta"]0xcdcdcdbd[/COLOR].[/code]Isn't that how uninitialized memory is filled in debug mode? | |
Re: With integer math 9/5 is 1 and 5/9 is zero. Try 9.0/5.0 and 5.0/9.0. | |
Re: [quote]Read address 00000000[/quote]This looks a bit like trying to dereference a NULL pointer. | |
Re: [URL="http://bloodshed.net/devcpp.html"]Dev-C++[/URL]? [url]http://compilers.net/Dir/Free/Compilers/CCpp.htm[/url] | |
Re: I know very little CSS, but is [INLINECODE]:first-child[/INLINECODE] a possibility? [url]http://www.w3schools.com/css/css_pseudo_classes.asp[/url] [url]http://www.w3schools.com/css/tryit.asp?filename=trycss_first-child[/url] [edit]Oops. I just noticed this: [I](does not work in IE)[/I] from the first link. | |
Re: 102 (decimal) = 1100110 (binary) 1 left shifted 4 is 10000 (binary)[code]1100110 (binary) + 10000 (binary) ------- 1110110 (binary) = 118 decimal[/code]If I understand you.[code]#include <stdio.h> int main(void) { int number = 102, index = 4; [COLOR="Blue"]number += 1 << index;[/COLOR] printf("number = %d\n", number); return 0; } /* my … | |
Re: [QUOTE=puppy]If I want to generate random numbers between -1 and 1, do I need to write a function to do that or is their something in the stdlib that can do it?[/QUOTE]Something like this, perhaps? [code]double drand(void) { return 2.0 * rand() / (RAND_MAX + 1.0) - 1.0; }[/code] | |
| |
Re: You may have missed this [URL="http://www.daniweb.com/techtalkforums/announcement8-2.html"]announcement[/URL]. | |
Re: Your best bet would probably be in the documentation for that function. I'd have to start here. [url]http://www.google.com/search?q=SPI_modifytuple+HeapTuple+SPI_modifytuple[/url] | |
Re: To start, as a declaration this[code]int asn[MAX_ASN];[/code]defines an array of size MAX_ASN of ints. When used later this [inlinecode]asn[MAX_ASN][/inlinecode] is a an int (one beyond the end of the declared array. And for functions expecting a pointer to a double, provide a pointer to a double (rather than to an … | |
Re: [QUOTE=Rass Saee]The following example crashes when I call the member that is pointing to a function.[/QUOTE]You don't call a member function because you have not yet assigned one. [code]#include <stdio.h> #include <stdlib.h> typedef long fooPtr(char *); typedef struct { fooPtr *func; long cnt; } MyStruct; /******************************************************************************/ long func(char * str) … | |
Re: [QUOTE=Bench]However, a variable which holds a 'C' String is [B]not[/B] an array but a pointer to the first element of that array. [CODE]char* myName = "Fred"; char myNickname[] = "Bloggsy"; [COLOR="DarkRed"]// These are equivalent.[/COLOR] [/CODE][/QUOTE]No, they are not equivalent. Similar, but not the same. [QUOTE=Bench]With this in mind, a 2D … | |
Re: Cross references: [URL="http://cboard.cprogramming.com/showthread.php?t=78335"]here[/URL] and [url=http://www.programmingforums.org/forum/showthread.php?p=92014#post92014]here[/url] (for those who weren't aware that other replies to this question exist already). | |
Re: Some stuff for dealing with dates and times is shown [URL="http://www.daniweb.com/code/snippet367.html"]here[/URL] and [URL="http://www.daniweb.com/code/snippet263.html"]here[/URL]. The milliseconds part is a bit non-standard, but you could perahps handle that separately. | |
Re: [url]http://www.parashift.com/c++-faq-lite/pointers-to-members.html[/url] | |
Re: Friendliness is subjective. And technical subjects attract a certain sort of beast.[quote]Exaggeratedly “friendly | |
Re: [CODE]printf("Enter your desired grade"); scanf([color=Red]"[/color]%c,&desiredgrade[color=Red]"[/color]); printf("Enter your current average in the course"); scanf([color=Red]"[/color]%f,¤taverage[color=Red]"[/color]); printf("Enter the final exam weight\n"); printf("as a percentage of the course grade"); scanf([color=Red]"[/color]%lf,&weight[color=Red]"[/color]);[/CODE]Note the position of the closing quotes. And pay attention to the format specifiers. [CODE]printf("Enter your desired grade"); scanf([color=Blue]"[/color]%c[color=Blue]"[/color],&desiredgrade); printf("Enter your current average in the … | |
Re: [QUOTE=Sulekha]my program[/QUOTE]What program? | |
Re: [QUOTE=JoBe]If the following code is legal, what can we infer about the return type of f?[/QUOTE]That it returns a pointer to a double:[code]double *f()[/code]Possible usage:[code]#include <iostream> double *f() { static double value[] = {1,2,3,4,5}; return value; } int main ( void ) { int n = 2; double d = … | |
Re: [QUOTE=cscgal]Okay, now you're a forum junkie - you just LOVE forums. But you're not going to spend your life posting to every forum in existence. So what is the threshold level? What determines a forum worth your time from one that isn't?[/QUOTE]Do I learn things when I think I know … | |
Re: [url]http://eternallyconfuzzled.com/tuts/sorting.html#insert[/url] | |
| |
Re: [QUOTE=aripaka]I would like to know what is the Dev C++ by Bloodshed?[/QUOTE][url]http://www.bloodshed.net/devcpp.html[/url] [quote]Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other … | |
Re: Can you show us an attempt at a solution, rather than just asking the question again on [url=http://forums.devshed.com/c-programming-42/problem-with-file-reading-in-c-316937.html]a different forum[/url] or [url=http://cboard.cprogramming.com/showthread.php?t=74331]two[/url]? | |
Re: Hmm...[QUOTE=anant][COLOR=Red]m[/COLOR] sure it [COLOR=Red]gonna[/COLOR] be beneficial to me.. [COLOR=Red]wel m[/COLOR] facing problem in [COLOR=Red]dis[/COLOR] assignment..[COLOR=Red]as m nt dt gud[/COLOR] in c++ [COLOR=Red]programmin[/COLOR]...[COLOR=Red]pls[/COLOR] help me out .....we have to use doubly linked list...[COLOR=Red]n ya[/COLOR] if its possible in Borland's C++ Builder6(pro)2005 compiler....as in my [COLOR=Red]uni i[/COLOR] have to use [COLOR=Red]dis[/COLOR] compiler...[/QUOTE]This … | |
Re: Perhaps something like this? [code]#include <iostream> #include <cstring> char *foo(char *original) { size_t len = strlen(original) + 1; [COLOR=Blue]char *copy = new char[len];[/COLOR] for ( size_t i = 0; i < len; ++i ) { copy[i] = original[i]; } return copy; } int main(void) { char *text = foo("hello world"); … ![]() | |
Re: Here's your original code beautified (indenting), good habit-ized (full bracing always), mostly usual-idiomed (for loop initialization and condition), and fairly de-loused (unnecessary stuff removed, etc.). [code]#include <stdio.h> #include <stdlib.h> #include <time.h> int RollOne ( void ) { return (rand() % 6) + 1; } void PrintX ( int howMany ) … |
The End.