2,384 Posted Topics
Re: That's icky, but it's a start. How about you post an attempt, [I]wheelz[/I]? | |
Re: [QUOTE=amano]Sorry 4 da mistake. Anyway, anybody can give me some ideas please.......[/QUOTE]I'd say first brush up on user input.[code]scanf("%s", contactbook.name); gets(Tar);[/code][url=http://www.daniweb.com/tutorials/tutorial45806.html]User Input: Strings and Numbers [C][/url][code]while (!feof(Contactbook))[/code][url=http://www.daniweb.com/techtalkforums/post155265-18.html]Avoid Loop Control Using eof()[/url] And it might be helpful to post a program that attempts to use/test these functions rather than leaving that … | |
Re: Several no-ops? What is your question? | |
Re: [code]printf("Employee name: %s\n",[B]*[/B]name);[/code] And functions don't have semicolons at the end. [code]node.name = " Tim";[/code]Eventually this will cause you issues. C-style strings are copied using [INLINECODE]strcpy[/INLINECODE] (but they need writeable memory to do so). | |
Re: [QUOTE=Infarction;251961]Lastly, and unsigned int is the same size as an int, which is 4 bytes on a 32-bit CPU and 8-bytes on a 64-bit CPU[/QUOTE]Maybe true, maybe not. Making size assumptions is not really helpful. | |
Re: [QUOTE=the.future.zone;249928]1) c = *a and 2) *a = c [/QUOTE]I read it as "1) [I]c[/I] is assigned the value pointed to by [I]a[/I]", and "2) the thing pointed to by [I]a[/I] is assigned the value of [I]c[/I]". | |
Re: Maybe take a peek in the [url=http://www.daniweb.com/code/]Code Snippets[/url]? | |
Re: When you created the project, you didn't tell it the correct type of application to make. If you are making a console application, use [INLINECODE]main[/INLINECODE]; if you are making a GUI application, use [INLINECODE]WinMain[/INLINECODE]. | |
Re: If you are just starting, you'll probably want a loop (the STL does have a function to do [edit]summing[/edit], but I'm guessing that if you posted this question then you need to start further back). The average would be the sum divided by the total number of items. | |
Re: If you've got to use [INLINECODE]scanf[/INLINECODE] and you're new, lord help you until you can ditch it. [url=http://www.daniweb.com/tutorials/tutorial45806.html]User Input: Strings and Numbers [C][/url] | |
Re: [QUOTE=Natrius;249280][B]1.[/B] I'm making a program with a default constructor and an overloaded constructor. They're both called by different rules and produces a testline of text when called. The assignment is to give the overloaded constructor default arguments to see what happens. I wonder, what is a default argument i an … | |
Re: [code]const SALAD = "Green Salad"; // 2[/code]Forgetting anything? Like maybe a data type? Perhaps a header or two? Basic syntax such as parentheses for functions or a semicolon to terminate a statement? Actually defining a variable named DESSERT? | |
Re: [url=http://www.daniweb.com/techtalkforums/post94143-2.html]Equivalent loops[/url] [edit][url=http://www.daniweb.com/code/snippet141.html]Binary to Decimal[/url] | |
Re: [QUOTE=andor;249499]No. Istead of gcc type g++. Of course the file name is cpp instead of c.[/QUOTE]A rather odd thing to do for C code. | |
Re: Which brings us to this: [url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.2[/url] | |
Re: You may also have better luck going straight to the source. [url]http://forum.microchip.com/[/url] Embedded systems have lots of quirks. And you'll certainly find more folks with direct relavant advice there. | |
Re: how to generate a state transition diagram in c.. give me the implementation steps http://en.wikipedia.org/wiki/Finite_state_machine Can you show your initial attempt? This helps gauge what you can handle for a reply. | |
Re: Remeber that C++ is case-sensitive (uppercase and lowercase matter). | |
Re: We had this topic no so long ago... [thread]50101[/thread] | |
Re: [code]#include <stdio.h> [COLOR="Magenta"]/*#include <conio.h>*/[/COLOR] [COLOR="Blue"]int [/COLOR]main() { [COLOR="Blue"]int[/COLOR] alp; alp = getchar[COLOR="Blue"]()[/COLOR]; switch ( alp ) { case [COLOR="Blue"]'[/COLOR]1[COLOR="Blue"]'[/COLOR] : puts("one"); [COLOR="Blue"]break;[/COLOR] default: puts("default"); break; } [COLOR="Blue"]return 0; }[/COLOR][/code] | |
Re: [code]struct date[COLOR="Magenta"]{}[/COLOR] d; /*fm.1=fopen("member.dat","a+"); ft.1=fopen("trans.dat","a+"); fb.1.2=fopen("car.dat","a+");*/ //FILE *fm,*fb,*ft; FILE * fm = fm.[COLOR="Magenta"]1[/COLOR]; FILE * fb = fb.[COLOR="Magenta"]1[/COLOR]; FILE * ft = ft.[COLOR="Magenta"]1[/COLOR];[/code]What's date supposed to be? 1 is not a legal identifier -- what are you trying to do there? | |
Re: The functions in your header need to be defined. | |
Re: Some basic parts: [code]#include <stdio.h> [COLOR="Blue"]int count_ones(const char *text) { int ones = 0; for ( ; *text; ++text ) { if ( *text == '1' ) { ++ones; } } return ones; }[/COLOR] int main(void) { const char *text[] = { "1101110", "1001101", "1011011", }; [COLOR="Blue"]int total = 0;[/COLOR] … | |
When you want to kick back and relax, what's your poison? | |
| |
Re: [QUOTE=Gunner54]Ok Im Back I Think these Are the Last Error's Of The Lot This is My Code [CODE] #include <windows.h> void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) { DWORD d, ds; VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d); memset(address, type, bytes); VirtualProtect(address,bytes,d,&ds); } [/CODE] And These Are My Error's [CODE] error C2065: 'address' … | |
Re: >what do you mean by "freestanding implenentation"? [quote]In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined. Any library facilities available to a freestanding program, other than the … | |
I am posting this to note any bugs/issues noticed with the upgrade. Lemme start: Is the LOGOUT intentionally on a separate line? | |
Re: FWIW: [url]http://en.wikipedia.org/wiki/Identifier_naming_convention[/url] BTW, I'm non-Hungarian, no problem with short names where appropriate. | |
It would be nice to be able to preview a new blog entry or code snippet. As much as I try to get it right the first time, I'm always missing something. I've continually re-edited code snippets, but I'm only just starting to mess with the blogs. And there I … | |
Re: First, this indicates that you seem to be compiling as C++ (or C99) instead of C(89). [code]int main() { char word[10]; char *a,*p,*b; b=p=word; //b is storing the base address for future reference [COLOR="Magenta"]int flag=0,len,count=0,disp=0; char buf[BUFSIZ]; char *c; a=buf;[/COLOR][/code]Staying in C or staying in C++ is preferable to mixing … | |
Re: [QUOTE=dannyfang]Could anyone show me how the string representation of a number like "456" can be converted to its integer equivalent?[/QUOTE][code]#include <stdio.h> int main(void) { int i, value; const char text[] = "456"; for (i = 0, [COLOR=Blue]value = 0[/COLOR]; text [ i ] != '\0'; ++i) { [COLOR=Blue][B]value *= 10;[/B][/COLOR] … | |
Re: Where are these? [code]#include "book.h" #include "tape.h"[/code]And anything else that would be necessary? | |
Re: Here's your lint:[code]PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software 1985-2006 --- Module: test.c (C) test.c 25 error [Info 718] Symbol 'clrscr' undeclared, assumed to return int test.c 25 error [Info 746] call to function 'clrscr()' not made in the presence of a prototype test.c 37 error [Info 718] … | |
Re: [QUOTE=Lerner]change this: [COLOR="Magenta"]*line++;[/COLOR] //point *line to the next array element to this: line++; //point *line to the next array element line is the pointer. *line is the value at the address being held in the pointer[COLOR="Magenta"]. You want to advance the pointer to the next element in array, not the … | |
Re: There is also a [url=http://www.daniweb.com/code/snippet488.html]Hex Dump[/url] example in the [url=http://www.daniweb.com/code/]Code Snippets[/url]. | |
Re: [QUOTE=Ancient Dragon]just an alternate compare. qsort() doesn't care about actual values, just cares about 0, < 0 or > 0. [code] int compare (const void* source, const void* dest) { return ((List*)source)->value - ((List*)dest)->value; } [/code][/QUOTE]Except that that version is buggy. | |
Re: [QUOTE=dilip.mathews]This is how is [COLOR=blue]socklen_t[/COLOR] defined #define socklen_t int[/QUOTE]Maybe, maybe not. | |
Re: Don't resurrect dead threads. Being rude is not the best type of first post. Read the rules, learn how to ask a question. | |
Re: I'm assuming you mean to use a non-standard input function, so it would be best to state your compler and OS. | |
Re: Slightly mincing the order... [QUOTE=Wreef]Hello Everyone, This is my first post, I am very new to C++, infact only touched it once before today, so I need some help.[/QUOTE]Welcome! [QUOTE=Wreef]First problem, is the max number able to be genorated in C++ 2,147,483,647?? I read this in a tutorial...[/QUOTE]Well, that tutorial … | |
Re: [QUOTE=cscgal]As you guys may have noticed, I've been absent from DaniWeb for the past month and a half while I sorted out computer trouble.[/QUOTE]Aw, man! I've been too oblivious to notice! I shouldn't have been trying to abide by the new rules yet.:( [More of a critique on how out-of-it … | |
Re: [QUOTE=star22]thank u friend but how can I find example from google[/QUOTE]Isn't the point of the assignment for you to learn how to program? As opposed to learning how to Google for your exact problem? Which do you want to do -- learn to Google or learn to program? | |
Re: [QUOTE=00mike00uk]Hello everyone, i just signed up to the site. Ive been trying to learn c++ now for about a week. But every tutorial i find on the web (i have found lots) i dont seem to understand. it all seems so hard, but i realy would like to learn.[/QUOTE]Since it … | |
Re: Post the code you've begun to develop, and please use code tags. By posting your starting attempt, at least we can know whether you are using C or C++ since you didn't mention it. | |
Re: [QUOTE=Ancient Dragon]I know its possible to write binary files because I've done it hundreds of times, and so has almost everyone else.[/QUOTE]Writing structures as text files may be preferred for portability and human read/writeability. [url]http://c-faq.com/struct/io.html[/url] |
The End.