15,300 Posted Topics

Member Avatar for boujibabe

stop using scanf() because it may corrupt the input buffer and leave keys in the keyboard buffer. use fgets() instead [code] float num; char buf[16]; printf("blabla"); // get input from user fgets(buf,sizeof(buf),stdin); // convert to float num = atof(buf); [/code]

Member Avatar for ~s.o.s~
0
80
Member Avatar for gobiv

>>typedef basic_string<unsigned char> ustring; above is unnecessary. just use c++ string class. so you might as well delete that line. >>inData>>Name>>iNum[i]; If there are spaces in the name then above will not work because extraction operator >> stops at the first space. In that case you need to use getline() …

Member Avatar for gobiv
0
113
Member Avatar for chicagoavonlady

your program should read the first number -- 5 in your example -- then have a loop that reads that many more numbers. If the file contains more than one line like that, the program should have an outer loop that performs those actions for each line in the file.

Member Avatar for chicagoavonlady
0
112
Member Avatar for Mistro116

you could make foo1 a base class [code] class foo1() { // blabla }; class foo : private foo1 { // blabla }; [/code]

Member Avatar for Mistro116
0
123
Member Avatar for Sivakumar_K

please edit your post to use code tags -- all that unformatted code hurts my eyes.

Member Avatar for Ancient Dragon
0
81
Member Avatar for hariza

something like this: note, we are not going to write the program for you. [code] open the file do this until end-of-file is reached use extraction operator >> to read a word check each character and remove any non-alphabetic characters (hint: isalpha() macro will help you do make that check) …

Member Avatar for Ancient Dragon
0
87
Member Avatar for Sashar400

1. is the input file (data.txt) a binary file or a text file? If you can read it with Notepad.exe then its a text file, otherwise if the data is unreadable then its a binary file. Only binary files are read with iostream.read() function, text files use getline() or the …

Member Avatar for Ancient Dragon
0
221
Member Avatar for jado

I use IE6 at work and IE7 at home. Years ago I used Netscape, but the make a new version that I really hated and stopped using it.

Member Avatar for jbennet
0
155
Member Avatar for bluedos82

certifications --- hummmm. I have a HS graduation certificate, a marriage license, associates of arts degree, several medals from viet nam, a military retirement certificate, a social security card, a i will be getting an old-age social security retirement certificate in a couple years. I think that's enough certifications for …

Member Avatar for MIGSoft
0
577
Member Avatar for arun_kumar_c

We are all students -- some are just more experienced than others. I have been a student of computer programming for the last 30 years or so and feel like I am still learning this stuff. So just because you get a degree does not mean you will not stop …

Member Avatar for ~s.o.s~
0
2K
Member Avatar for rowly

use strchr() to find the comma then replace it [code] char str[] = "Hello,World"; // find the comma char *ptr = strchr(str,',') // replace it if found if(ptr != NULL) *ptr = ';'; [/code] Now, put the above in a loop to find and replace all the commas in the …

Member Avatar for rowly
0
355
Member Avatar for jan1024188

[QUOTE=jan1024188;260765]why that doesnt work? #include <stdio.h> int main () { char lala ; printf ("Enter string:"); scanf("%s", &lala); printf ("%s\n", lala ); return 0; }[/QUOTE] 1. please use code tags as shown in ~S.O.S~'s example. 2. you did not declare variable lala correctly -- study ~S.O.S~'s example and pay close …

Member Avatar for jan1024188
0
126
Member Avatar for Laiq Ahmed

I think what you want to read is [URL="http://www.daniweb.com/techtalkforums/thread13488-2.html"]this[/URL] thread.

Member Avatar for Infarction
0
96
Member Avatar for sugantha

badly formatted condional statement [code] if( (strcmp(ptr,"int")[color=red]== 0[/color]) || (strcmp(ptr,"float") [color=red]== 0[/color]) ) [/code]

Member Avatar for iamthwee
0
95
Member Avatar for Gigs_

Huh? I think you need a better explaination. Most programs written today can process that size file. But if you use some ancient compiler such as Turbo C then you can probably forget about it.

Member Avatar for ~s.o.s~
0
120
Member Avatar for shiman999

[URL="http://www.turboexplorer.com/"]They're back!:[/URL] :eek: [IMG]http://www.turboexplorer.com/css/CPPboxshot.jpg[/IMG]

Member Avatar for Ancient Dragon
0
155
Member Avatar for Scottg1989

I am using IE7 and really like it -- I see no reason now to use FireFox. The only reason I used it before was because of the tabs, and now Microsoft as [b]borrowed[/b] that idea. I don't see any advantage of running FireFox over IE7.

Member Avatar for pistolsnipe16
0
122
Member Avatar for mypranoygarg

yes -- but you have to write the program youself. We are here to help YOU write programs, not for us the do your work. What does a timekeeper like shape look like ???

Member Avatar for bumsfeld
0
87
Member Avatar for ashish.bagade

normally yes, write a thread-safe wrapper for the functions in the library. How to do that depends on the compiler and operating system you are using.

Member Avatar for Ancient Dragon
0
52
Member Avatar for kenjutsuka

[code] for (x=0; x <strlen(pword); x++) { file2.open(fname, ios::in); file2.getline(stuff, 3); file2.close(); cout << (char)okay; } [/code] What the H is the above supposed to do? What it [b]IS[/b] doing is opening a file, reading the first line, the closing the file -- all that possibly hundreds of times (depending …

Member Avatar for Ancient Dragon
0
112
Member Avatar for Sivakumar_K

looks like a missing library. you probably need to add libodbccp32.a to library list.

Member Avatar for Ancient Dragon
0
2K
Member Avatar for Behzad Oskooi

I don't know the answer, but I hope you realize that in many countries (like USA) recording telephone conversions is illegal unless (1) you have the permission of the person being recorded, or (2) you have a court order, or (3) you happen to be the President of the US …

Member Avatar for WolfPack
0
91
Member Avatar for zac_haryy

you can not use the name of functions as the name of a variables. Function names must be different from variable names. Example: residential_rate is used both as a function name and a variable name, and since the variable name is in _tmain() the compiler is treating that symble as …

Member Avatar for zac_haryy
0
102
Member Avatar for Behzad Oskooi

I don't really know a thing about that file, but that sort of error message usually means the file is not in one of the directories in the PATH environment variable. search the hard drive to see if that file was installed. If not, then install it.

Member Avatar for Behzad Oskooi
0
126
Member Avatar for rowly

>> i didn't get any reply I don't recall seeing another post -- did I miss it? 1. is that a C or a C++ program? You include both stdio.h and iostream, yet you use C file i/o functions. Make up your mind which kind of program you want and …

Member Avatar for rowly
0
103
Member Avatar for vbcielle

why is sum a linked list and not a simple integer? [code] int sum(nd **head){ nd *pl [color=red]int sum1 = 0;[/color] p=*head; while(p!=NULL) { sum1 += p->x; p=p->next; } return sum1; } [/code]

Member Avatar for vbcielle
0
152
Member Avatar for whitemoss

you will have to 1) learn SQL database language -- SELECT, INSERT and UPDATE are three most commonly used SQL functions. 2) learn how to use ODBC to access the database from C, C++ or most any other computer language. [URL="http://www.easysoft.com/developer/languages/c/odbc_tutorial.html"]Here[/URL] is a short tutorial to get you started. And …

Member Avatar for whitemoss
0
507
Member Avatar for ATS

anyone know where to buy it? I checked M$ site but they only linked to hardware manufacturers, such as Dell, HP, and IBM. All I want is the os, I already have the hardware.

Member Avatar for chunkmartinez
0
179
Member Avatar for LieAfterLie

>>Okay, Iv'e finished learning C++. :cheesy: :cheesy: :cheesy: :cheesy: :cheesy: :cheesy: you will NEVER be finished learning c++. That is a life-long task. If you want to learn MS-Windows GUI programming [URL="http://www.winprog.org/tutorial/"]here[/URL] is a good introduction. Its c instead of c++ but then so is all the win32 api functions …

Member Avatar for LieAfterLie
0
106
Member Avatar for yenh

worst case: run it on an old 80x88 computer that has 0.4 MG CPU chip, if you can find it. best case: run it on a [URL="http://www.cray.com/"]cray computer[/URL] average: average the two above seriously: the timings will all depends on the os and CPU you run it on. And you …

Member Avatar for Ancient Dragon
0
81
Member Avatar for UrbanKhoja

[URL="http://en.wikipedia.org/wiki/Serendipity"][b]Serendipity[/b][/URL] because I find something new almost every day, especially in these programming web sites:)

Member Avatar for ~s.o.s~
0
91
Member Avatar for taruj83

does the code compile with no errors? It does not with my compiler. You have to fix all the errors before attempting to run the program. >> void main() main never ever returns [b]void[/b]. The correct way to dealre that function is like this -- any other way is wrong.: …

Member Avatar for iamthwee
0
176
Member Avatar for yogi_bear_2k2

I work with two women -- one is my supervisor and the other does the same thing as I do. Our company has several other women too, one has a Ph.D. of some sort.

Member Avatar for pty
0
178
Member Avatar for vevek

congratulations on passing the exam. May the money start flowing in from all around you :) :) :)

Member Avatar for Ancient Dragon
0
47
Member Avatar for byrdgirl

your best bet for answers is to find a users-group that specializes in that language. Check out their web site to see if they have one posted.

Member Avatar for Ancient Dragon
0
61
Member Avatar for Sumaira

you mean you want to create a web site something like [URL="http://www.programmersparadise.com/PPI_US/Default.aspx?source=webgoog"]this[/URL] ?

Member Avatar for Ancient Dragon
0
109
Member Avatar for shermaine

[QUOTE=shermaine;258907]Thanks! But it doesn't seem to get any output? Please advise. Anything i should input to show output like f(5) = 5? Thanks.[/QUOTE] what output are you expecting? your program does not contain any code to print anything on the screen. For C programs use printf() function, c++ programs use …

Member Avatar for Ancient Dragon
0
330
Member Avatar for vijaiendran

>> how to pass a string as an argument to a sub fuction The same as you would any other data type [code] void foo( const char* some_string) { } int main() { foo("Hello World"); return 0; } [/code] >>what is the maximum limit of subscripts that the character array …

Member Avatar for Ancient Dragon
0
85
Member Avatar for nanodano

the loop is formatted wrong. Crevat: atof() does not detect errors in the string, but it doesn't really matter if you know the strings are all formatted ok. [code] while( in.getline(ch, 256, '\n')) { numbers.push_back(atof(ch)); } [/code] better yet, use a std::string instead of a char array [code] std::string line; …

Member Avatar for nanodano
0
130
Member Avatar for jfinch99

there are several [URL="http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html"]examples and tutorials[/URL]. I suggest you use a structure to hold the data for one account then put the structures in an array. That helps keep all the data together when sorting and searching. The actual algorithm you are looking for is almost the same as shown …

Member Avatar for jfinch99
0
71
Member Avatar for tlly

why not just index into the string? You don't need a vector just to get a character from the string object. [code] std::string s = "Hello World"; for(size_t i = 0; i < s.length(); i++) { char c = s[i]; cout << c << "\n"; } [/code] If you really …

Member Avatar for ~s.o.s~
1
363
Member Avatar for shermaine

[code] #include <stdio.h> int bitcount(unsigned x) main() { int b; for (B=0; x!=0; x >>=1) [color=red]<<< Where are these variables declared?[/color] if (x &01) btt [color=red]<<< what the he!! is this??? [/color] return b; } [/code]

Member Avatar for shermaine
0
98
Member Avatar for king_dinesh

what do you want to know about fractions? (see any 2nd grade math book -- if you are in college then shame on you!:mrgreen: )

Member Avatar for Ancient Dragon
0
48
Member Avatar for shermaine

Shermaine: you need to edit your post and reformat that code to make it readable -- I'm not going to read that crap!

Member Avatar for Ancient Dragon
0
243
Member Avatar for jc23

I don't know the first thing about it, but from what little I found in [URL="http://homepage.usask.ca/~ijm451/finite/fe_resources/fe_resources.html"]google links[/URL] it looks like it is pretty involved. Scroll down the page and you will find some free source code. I don't know how good it is so use it at your own risk.

Member Avatar for Ancient Dragon
0
77
Member Avatar for shermaine

>>may i know how should i write to prompt user to enter the four weights from the keyboard. just create a loop for this [code] int i; float weights[4] = {0}; char buf[80]; for(i = 0; i < 4; ++i) { printf("Enter weight #%d", i+1); fgets(buf,sizeof(buf),stdin); weights[i] = atof(buf); } …

Member Avatar for Ancient Dragon
0
79
Member Avatar for jan1024188

main() always returns an int, never void. There are still a lot of bad examples on the net that show void main() but they are obsolete and wrong. [code] int main() { // your code here return 0; } [/code]

Member Avatar for andor
0
116
Member Avatar for Fatshadow

c++ or c programs (or programs written in any other language for that matter) are unreliable at best because the os may overwrite the sectors on the next write. Even Norton Utilities is not all that reliable. MS-Windows added the trash can for exactly that purpose, when a file is …

Member Avatar for Salem
0
1K
Member Avatar for CurtisBridges

why are those double and int arrays 2-dimensional??? Arrays must have a name. There are a couple ways you can to it. Leave the array size unspecified and pass the size as another parameter, as in your original attemp. [code] void PrintArray(double array[], int array_size); void BubbleSort(double array[], int array_size); …

Member Avatar for CurtisBridges
0
99
Member Avatar for alksja

>>can u guys help do the totalunitcost for each specific customer, i tried everything could get it done If totalunitcost is the simple sum of rSale[i].UniCost, then just sum it up while reading the data file. [code] fread(rSale[i].UniCost,3,7,fps); totalunitcost += atof(rSale[i].UniCost); // assume this is a float [/code]

Member Avatar for Ancient Dragon
0
189

The End.