2,384 Posted Topics

Member Avatar for wheelz
Member Avatar for Infarction
1
283
Member Avatar for amano

[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 …

Member Avatar for Dave Sinkula
0
1K
Member Avatar for govinda.attal
Member Avatar for Fabii23

[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).

Member Avatar for Ancient Dragon
1
92
Member Avatar for Dave Sinkula
Member Avatar for himanjim

[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.

Member Avatar for Dave Sinkula
1
539
Member Avatar for the.future.zone

[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]".

Member Avatar for ~s.o.s~
2
119
Member Avatar for codeme

Maybe take a peek in the [url=http://www.daniweb.com/code/]Code Snippets[/url]?

Member Avatar for ~s.o.s~
1
169
Member Avatar for bobeagle

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].

Member Avatar for GloriousEremite
1
161
Member Avatar for Maxxpower

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.

Member Avatar for ~s.o.s~
1
140
Member Avatar for promiscuoustx

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]

Member Avatar for WaltP
1
955
Member Avatar for Natrius

[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 …

Member Avatar for WolfPack
1
167
Member Avatar for GsxRacer

[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?

Member Avatar for andor
1
224
Member Avatar for becki

[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]

Member Avatar for WaltP
1
190
Member Avatar for Tlhokomelo

[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.

Member Avatar for John A
0
159
Member Avatar for kimw

Which brings us to this: [url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.2[/url]

Member Avatar for Dave Sinkula
2
303
Member Avatar for BombAppetit

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.

Member Avatar for mostafadotnet
1
140
Member Avatar for ashokkumarrsp

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.

Member Avatar for Dave Sinkula
1
856
Member Avatar for V1RuZ
Member Avatar for Dave Sinkula
1
236
Member Avatar for dilip.mathews
Member Avatar for WolfPack
1
476
Member Avatar for the.future.zone

[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]

Member Avatar for Lerner
0
166
Member Avatar for brianotieno
Member Avatar for brianotieno

[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?

Member Avatar for Dave Sinkula
0
235
Member Avatar for gothicpurple
Member Avatar for insamd

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] …

Member Avatar for insamd
0
393
Member Avatar for Dave Sinkula
Member Avatar for hay_man
Member Avatar for Grunt
0
157
Member Avatar for Gunner54

[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' …

Member Avatar for Gunner54
0
812
Member Avatar for grunge man

>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 …

Member Avatar for grunge man
0
754
Member Avatar for Dave Sinkula

I am posting this to note any bugs/issues noticed with the upgrade. Lemme start: Is the LOGOUT intentionally on a separate line?

Member Avatar for happygeek
0
388
Member Avatar for aeinstein

FWIW: [url]http://en.wikipedia.org/wiki/Identifier_naming_convention[/url] BTW, I'm non-Hungarian, no problem with short names where appropriate.

Member Avatar for aeinstein
0
2K
Member Avatar for Dave Sinkula

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 …

Member Avatar for Dani
0
276
Member Avatar for s s paul

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 …

Member Avatar for Dave Sinkula
0
155
Member Avatar for dannyfang

[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] …

Member Avatar for Dave Sinkula
0
333
Member Avatar for SHWOO

Where are these? [code]#include "book.h" #include "tape.h"[/code]And anything else that would be necessary?

Member Avatar for Salem
0
240
Member Avatar for jenedge05
Member Avatar for cezarjont

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] …

Member Avatar for cezarjont
0
928
Member Avatar for puuukeey

[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 …

Member Avatar for Dave Sinkula
0
154
Member Avatar for anu_dinoo
Member Avatar for jazzz

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].

Member Avatar for jazzz
0
253
Member Avatar for sgriffiths

[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.

Member Avatar for ~s.o.s~
0
691
Member Avatar for slacke

[QUOTE=dilip.mathews]This is how is [COLOR=blue]socklen_t[/COLOR] defined #define socklen_t int[/QUOTE]Maybe, maybe not.

Member Avatar for slacke
0
117
Member Avatar for soft_pro

Don't resurrect dead threads. Being rude is not the best type of first post. Read the rules, learn how to ask a question.

Member Avatar for Dave Sinkula
0
904
Member Avatar for faizalw

I'm assuming you mean to use a non-standard input function, so it would be best to state your compler and OS.

Member Avatar for Lerner
0
111
Member Avatar for Wreef

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 …

Member Avatar for Wreef
0
734
Member Avatar for Dani

[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 …

Member Avatar for Dani
0
172
Member Avatar for star22

[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?

Member Avatar for Dave Sinkula
0
213
Member Avatar for 00mike00uk

[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 …

Member Avatar for Dave Sinkula
0
227
Member Avatar for comp_sci11

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.

Member Avatar for Grunt
0
445
Member Avatar for degamer106

[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]

Member Avatar for degamer106
0
258

The End.