218 Posted Topics

Member Avatar for edy_ml

You have a lot of repetitive code there that could go outside of the if statement . . .

Member Avatar for WaltP
0
156
Member Avatar for Mac.Z

[QUOTE=Mac.Z;312016]Hello, I'm getting started with C++ and have some questions about the variable types: 1)The size of a variable type, is it defined by the compiler or computer or both? and why it differ from one to another?[/quote] C was designed with efficiency in mind. (And C++ was developed with …

Member Avatar for John A
0
120
Member Avatar for hela

[quote] Pressing the INSERT key causes the editor to toggle between insert mode and overlay mode. In insert mode, when you type, characters to the right of the cursor are moved to the right to make room. In overlay mode, when you type, characters to the right of the cursor …

Member Avatar for John A
0
491
Member Avatar for frank12

You're also missing a closing curly brace [inlinecode]}[/inlinecode] at the end of your program, but that's probably just a typo.

Member Avatar for rinoa04
0
87
Member Avatar for VIDHYAPREM

[quote]Q. Why is Turbo C not able to find any of my #include files? A. The compiler searches for include files in the Turbo C Include Directories. This option is specified under the Options/Directories menu. The INSTALL program initially sets this option to the directory where it copied all the …

Member Avatar for ~s.o.s~
0
94
Member Avatar for dukiduki

You might actually be getting a warning where you call system(), because system()'s prototype is in <stdlib.h>, which you haven't included. [code]char izbor[2];[/code] You can't expect that string to be able to store "da\0", which is three characters. Remember, you have to leave space for the NULL. Even if you …

Member Avatar for dwks
0
220
Member Avatar for jan1024188

[url]http://www.daniweb.com/code/snippet83.html[/url] [url]http://www.daniweb.com/code/snippet72.html[/url]

Member Avatar for apurv
0
118
Member Avatar for Sturm

[QUOTE=joeprogrammer;296523]Yup, use the [URL="http://http://www.cplusplus.com/reference/clibrary/cstdlib/system.html"]system()[/URL] command. For example: [code] system("DIR C:\"); [/code] lists the contents of the C:\ drive. Simply enter in the path of the script, and you're good to go. Hope this helps [edit]Too slow...[/edit][/QUOTE] Presumably you meant [code]system("DIR C:\[color=blue]\[/color]"); [/code] Also see [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044654269&id=1043284392[/url]

Member Avatar for John A
0
118
Member Avatar for himanjim

That program is meant to be compiled with [url=www.delorie.com/djgpp]DJGPP[/url]. Use the version meant to compile with Borland compilers: [url]http://www.brackeen.com/home/vga/source/bc31/bitmap.c.html[/url] Better yet, stop using such an old compiler and get Dev-C++ and install the SDL (which has built-in support for .BMP files, and with SDL_Image supports .pngs, .jpegs, .tiffs, and many …

Member Avatar for himanjim
0
309
Member Avatar for sTorM

[code]Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [/code] Use [b]int function()[/b] or [b]void function()[/b], not just [b]function()[/b]. Which line is this on? [code]Warning 3 warning C4154: deletion of an array expression; conversion to pointer supplied [/code] [edit] I get more errors …

Member Avatar for John A
0
223
Member Avatar for JRM

[quote]I am using code blocks with the gcc compiler and the gdb debugger (which is a little buggy itself). [/quote] How so? You just have to know how to use it. Here is one GDB tutorial: [url]http://www.dreamincode.net/forums/showtopic13243.htm[/url] Here is another: [url]http://www.cprogramming.com/gdbtutorial.html[/url]

Member Avatar for JRM
0
108
Member Avatar for nuwan243
Member Avatar for dwks
0
103
Member Avatar for ReDeViL

[QUOTE=johnpeter1989;277903]for dates, there is an inbuilt structure in dos.h to get help in the cpp just get help on date the date structure has just 3 items,day month and year. there are in built functions to get current date the following code will fill the structure item d1 with the …

Member Avatar for dwks
0
140
Member Avatar for Akks_3

[QUOTE=Akks_3;252374]hi! The point is, it will involve a huge overhead to switch to TC (as I have'nt installed it on my notebook). I just needed to plot a histogram on a graph in bcc. will WinGDI help. If so, kindly send me a rough code.[/QUOTE] I imagine the overhead would …

Member Avatar for alexwinger
0
2K
Member Avatar for complete

basetsd.h isn't a standard header file, as you can find out by googling it. Therefore dropping the .h wouldn't help much; only the standard C++ header files have no extension. Of course, you're free to call the header basetsd without a .h; but there's no reason to believe that the …

Member Avatar for FireSBurnsmuP
1
180
Member Avatar for Ajay Raj

[code]#include < IOSTREAM >[/code] Header files are case-sensitive, and those spaces are part of the name, too. Use this instead: [code]#include <iostream>[/code] Then change [code]cout<<**weekdays;[/code] to [code][b]std::[/b]cout<<**weekdays;[/code] Then it will compile. The program's output will be [inlinecode]S[/inlinecode]; **weekdays is the same as weekdays[0][0]. The first character of the first string …

Member Avatar for Ajay Raj
1
128
Member Avatar for amano

[quote][quote]fflush dosn't work for input streams and I think it's system("cls"); instead of system("clear"); [/quote] system("cls") for windows system("clear") for unix(knoppix) the problem right now that i want to cocentrate at is Search function and Delete function. Anybody know. Pls help me. Urgent....... [/quote] As andor mentioned: Why not to …

Member Avatar for Dave Sinkula
0
1K
Member Avatar for dsraju

[quote]... could you please tell me is not necessary to cast while allocating using calloc/malloc?[/quote] This page covers it a bit more thoroughly: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1047673478&id=1043284351[/url]

Member Avatar for Iqbal_h_a
0
307
Member Avatar for vamsikirans
Member Avatar for complete

From [url]http://www.wcscnet.com/Products/CdrvPP/CdrvPPSupportQuestions%5B0001%5D.htm[/url] [quote]Make sure that you included the files CDRVPP.LIB, CDRVDL32.LIB, CDRVHF32.LIB, & CDRVXF32.LIB. They are found in the Lib directory for the Microsoft Visual C/C++ compilers and in the LibB directory for the Borland C/C++ compilers. [/quote]

Member Avatar for dwks
1
183
Member Avatar for ze_viru$
Member Avatar for mostafadotnet
1
124
Member Avatar for brianotieno

I think that qualifies as spagheti code . . . . [code]fflush(stdin);[/code] Don't do that: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351[/url] Do this: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044873249&id=1043284392[/url]

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

[quote]It simply means that the storage space (number of bytes) in a double is twice the storage space of a float.[/quote] Actually, the ANI standard just states that a double must be at least as large as a float (and a long double at least as large as a double). …

Member Avatar for dwks
0
252
Member Avatar for proteusx

[code](source[pos] >= '0' && source[pos] <= '9')[/code] Look into [inlinecode]isdigit()[/inlinecode] in <ctype.h>. And isalpha() or isupper()+islower() for the other lines nearby. Have you every used getenv() before? . . . if not, try reading a man page or searching google for it.

Member Avatar for proteusx
0
443
Member Avatar for degamer106

Here's one of your problems: [code]double area; /* [...] */ printf("Area = %.2lf\n", area); [/code] Only scanf() uses [b]%lf[/b] for doubles and [b]%f[/b] for floats. printf() uses [b]%f[/b] for both; it doesn't have a [b]%lf[/b]. [code] DATA input; while (input.shape != 4) { [/code] auto structures are not initialized, just …

Member Avatar for degamer106
0
166
Member Avatar for anupamjamatia

If all you want to do is pause the console before the program exits: [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043803465&id=1043284385[/url]

Member Avatar for dwks
0
216
Member Avatar for sgriffiths

You can use the standard C function qsort(), which, despite its name, doesn't have to use a quicksort algorithm, just a sorting algorithm. If you want to just sort a couple of numbers then you could use the bubble sort (slow but simple). (Google for [url=http://www.google.ca/search?hl=en&q=bubble+sort&meta=]"bubble sort"[/url].)

Member Avatar for dwks
0
142
Member Avatar for comp_sci11

The keywords in C++ are listed here, and, as you can see, [b]flag[/b] isn't one of them: [url]http://www.cppreference.com/keywords/index.html[/url]

Member Avatar for dwks
0
280
Member Avatar for cyan033

[QUOTE=cyan033]If i type 3 as input i get "11=2Þ" if i remove the [inlinecode]strrev()[/inlinecode] function i get "Þ2=11" :P[/QUOTE] You could print the string backwards with a for loop: [code]for(int x = strlen(s)-1; x >= 0; x --) { cout << s[x]; }[/code]

Member Avatar for dwks
0
146
Member Avatar for squirrel

Put the [inlinecode]n2 = atoi(argv[2]);[/inlinecode] [i]after[/i] you check to see if the program got enough arguments (the [inlinecode]if(argc != 3)[/inlinecode]). Oh yeah . . . and add a semicolon. :)

Member Avatar for squirrel
0
259
Member Avatar for thehakan

Use code tags, as the quick reply box suggests. Have you tried using templates? (The syntax can be hard to remember.) Why don't you search for some template tutorials or read a C++ book?

Member Avatar for thehakan
0
149
Member Avatar for HelmsK85
Member Avatar for Salem
0
127
Member Avatar for type-r

There are three types of loops in C and C++: for loops, while loops and do-while loops. You'll need to clarify a bit. It appears you're having trouble with a do-while loop? And how is piping involved?

Member Avatar for dwks
0
50
Member Avatar for GM2001

[quote]Instead you use strcmp from <string.h>.[/quote] Or rather, as you pointed out, <cstring>. :)

Member Avatar for Dave Sinkula
0
93
Member Avatar for D.Mark Phillips

[quote]Where do I install the header file?[/quote] If you don't know this then you probably shouldn't try to use "graphics code". You can put it where all your other header files are stored (bad idea), put it in the same directory as your code and use #include [b]"[/b]file.h[b]"[/b] (okay idea), …

Member Avatar for dwks
0
151
Member Avatar for letish

It's [url=http://www.google.ca/search?hl=en&q=gotoxy&btnG=Search&meta=]gotoxy[/url] for Borland C++, I believe. And you should use fgets() instead of gets(). You'll also definitely need to use getch() and kbhit(). Google for them for more info.

Member Avatar for Lerner
0
509
Member Avatar for ghadahelal

[quote]there's an ignore function ignore (.... , .... ); this function 2 ignore some data from the input stream.[/quote] It looks like they mean the standard cin.ignore function. Why do you need to ignore three chars? Do you want to flush the input buffer?

Member Avatar for Bench
1
254
Member Avatar for SiliconSpec
Member Avatar for totalnewb++

[code]return current_y,current_x;[/code] You can only return one value from a function. Use [reference] parameters.

Member Avatar for dwks
0
146
Member Avatar for javamum
Member Avatar for comwizz
Member Avatar for comwizz
0
159
Member Avatar for ultirian

If you call your functions many times, it might be more efficient to open the file once.

Member Avatar for dwks
0
93
Member Avatar for Dabdob

main() returns 0 when no errors have occured. Your implementation of the bubble sort won't work. Try this: [code]void sort_array(int *array, int len) { int did; do { did = 0; for(int x = 0; x < len; x ++) { for(int y = x+1; y < len; y ++) …

Member Avatar for Dabdob
-1
172
Member Avatar for srishekh

Link with -lstdc++ (or -lstdcxx under DOS), or use g++ (or gpp under DOS): [code]$ g++ template.cpp -o template $ gcc template.cpp -o template -lstdc++ C>gpp template.cpp -o template.exe C>gcc template.cpp -o template.exe -lstdcxx[/code]

Member Avatar for Ancient Dragon
0
2K
Member Avatar for tyczj

[code]Darray& Darray::operator= (const Darray& darray); //assignment operator[/code] -> [code]Darray& operator= (const Darray& darray); //assignment operator[/code]

Member Avatar for tyczj
0
88
Member Avatar for Acidburn

You should post your errors. It makes it much easier to figure out what's going on. Your .cpp file needs to #include your .h file. If you have a global variable in one file, to make it visible in another file, you have to declare it as extern. [code]int variable; …

Member Avatar for Acidburn
0
111
Member Avatar for marioxp

Something like this? [code]void fill_array(char **array, int xs, int ys, char set) { for(int x = 0; x < xs; x ++) { for(int y = 0; y < ys; y ++) { array[xs][ys] = set; } } }[/code]

Member Avatar for marioxp
0
165
Member Avatar for YoTaMiX

When you have more than one program in one directory, you usually don't want to always use the executable name a.out. You can pass the -o option to g++ to specify the output file: [code]$ cat > randword.cpp #include <iostream> #include <cstdlib> #include <ctime> using std::cout; int main(void) { srand(time(0)); …

Member Avatar for WolfPack
-1
149
Member Avatar for shlinky

So this doesn't run: [code]CString bad; bad[999] = 'a';[/code] but this does: [code]char good[10000]; good[999] = 'a';[/code] It looks like a CString is equivalent to a char*. In that case, you need to allocate memory dynamically for it or use a char array. Your best bet would be to use …

Member Avatar for dwks
0
154
Member Avatar for mwo0002

[code] [color=blue]int [color=red]f[/color] = atoi (command.c_str());[/color] if (command == "f") { fin >> arg1; [color=blue]result = [color=red]f (arg1)[/color];//THIS LINE IS THE ERROR[/color] cout << "factorial of " << arg1 << "= " << result << "\n"; fout << "factorial of " << arg1 << "= " << result << "\n"; …

Member Avatar for mwo0002
0
307

The End.