15,300 Posted Topics

Member Avatar for ankur_
Member Avatar for Ancient Dragon
0
207
Member Avatar for #www#

in a loop, use % operator to get the last digit, then /= operator to shift digits right and drop the last digit. [code] #include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int x = 123; string a; while(x > 0) { int n = x%10; …

Member Avatar for #www#
0
159
Member Avatar for alvalany

unions are used whenever the same data can be represented in two or more ways, or by two or more data types. Normally I think unions are place inside structures, something like a [URL="http://www.canaimasoft.com/f90vb/OnlineManuals/UserManual/TH_34.htm"]VARIANT structure[/URL]. This structure has two members, an integer that tells which of the union members are …

Member Avatar for ankur_
0
139
Member Avatar for fhast

Use a friend function to overload the >> operator [code] class Time { private: int hour, minute, second; public: Time() {hour = mijnute = second = 0;} friend istream& operator >> (istream& in, Time& t); }; // Put this in the *.cpp file, not the *.h file istream& operator >> …

Member Avatar for fhast
0
7K
Member Avatar for LostnC

We only help those who help themselves. Post the code you tried. You will have to know a little about pointers if you are required to pass variables by reference.

Member Avatar for yellowSnow
0
1K
Member Avatar for power_computer

AFAIK there are no other FREE compilers for *nix. >>in labs we use the CC compiler I think that CC is just a generic name for *nix compilers. The real compiler could be almost anything.

Member Avatar for power_computer
0
159
Member Avatar for avi_2009
Member Avatar for mahatmagaga
0
173
Member Avatar for umarabbas

And of course it will depend on what operating system you are using.

Member Avatar for salmanoreen66
0
82
Member Avatar for yugatpt

what compiler are you trying to install. I don't have my crystal ball with me so you will just have to post it. If you are trying to install Turbo C on Vista then you can forget it because that compiler will not install on Vista. Get a modern compiler …

Member Avatar for Ancient Dragon
0
105
Member Avatar for preludeg5

more than likely attempting to write beyond the bounds of an array. Locating the error in large programs can be difficult. One method I have used is to comment out large blocks of code until the problem goes away.

Member Avatar for Ancient Dragon
0
92
Member Avatar for Dr EUU

How do you know which of the two methods are called? Neither actually do anything (just do-nothing methods)

Member Avatar for Dr EUU
0
85
Member Avatar for forislam14

>>i can't understand what these parameters means There are only two of them :icon_eek: [URL="http://linux.about.com/library/cmd/blcmdl3_execvp.htm"]Read this[/URL]. [quote] The execv and execvp functions provide an array of pointers to null-terminated strings that represent the argument list available to the new program. The first argument, by convention, should point to the file …

Member Avatar for Ancient Dragon
0
95
Member Avatar for Baseball400

So what's the big problem? You might have to change the structure of the whole problem, such as make a menu such as [quote] 1. Add new string to file 2. Display file contents 3. Quite [/quote] Then create a switch statement that processes the requested action.

Member Avatar for Ancient Dragon
0
79
Member Avatar for stoymigo

It depends on the program you write. [URL="http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/691bd371-f659-4f95-8ac9-ee538f0cf6f6"]You might read through this[/URL] rather old thread to see if it gives you any ideas.

Member Avatar for stoymigo
0
112
Member Avatar for FREEZX

If you are going to use new on line 16 then you have to delete[] it sometime later. Without that your program has a huge memory leak. Avoid that whole issue by not using pointers, declare the array on the stack. 30 strings is not going to cause stack overflow. …

Member Avatar for FREEZX
0
106
Member Avatar for theprofoundgeek

C programs do not need all those typcasts. Only C++ requires them. Why are you using all those difficult-to-follow pointer arithmetic? It would be much simpler and clearer to just use normal array indices via [] operator. [code] ptrB= calloc(row,sizeof(int *)); ptrC= calloc(row,sizeof(int *)); for (counter1=0;counter1<row;counter1++) { ptrA[counter1] = calloc(column,sizeof(int)); …

Member Avatar for Gaiety
0
155
Member Avatar for coachHinesfan

Try Code::Blocks. It works ok on Vista, so it will probably be on on Windows 7 too.

Member Avatar for jbennet
0
390
Member Avatar for JugglerDrummer

It's not that I know more than you, which may or may not be correct. But I've been here longer, answered more posts, and have been involved in more closed threads. 15 days ago [URL="http://www.daniweb.com/forums/thread226920.html"]I asked Dani to reduce my rep power [/URL]because I thought it was just excessive, which …

Member Avatar for shubh09
0
130
Member Avatar for restrictment

try this: compiled with vc++ 2008 express [code] #include <windows.h> #include <iostream> using std::cin; int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd,SW_MAXIMIZE); cin.get(); return 0; } [/code]

Member Avatar for SCoder1
0
168
Member Avatar for Gem74

>>when I compile, there are no errors, Ditch the compiler and use a different one. There is a link error. >>void print () Wrong. should be [icode]void testClass::print ()[/icode]

Member Avatar for Gem74
0
203
Member Avatar for XodoX
Member Avatar for raigs

you mean this?? [code] std::string command = "wget http://www.google.com"; system(command.c_str()); [/code]

Member Avatar for Ancient Dragon
0
337
Member Avatar for luoyangke
Re: \n

[URL="http://www.gillius.org/ctut/app_a.htm"]Here is a complete list[/URL]

Member Avatar for Dave Sinkula
0
113
Member Avatar for Ancient Dragon

Is is possible for you to reduce the amount of negative rep I can give from 30 to something more reasonable, say 10? I'd like to occasionally give negative rep but I don't want to completely destroy the member. Maybe there should be a maximum negative rep that can be …

Member Avatar for VernonDozier
0
1K
Member Avatar for kiran islam

Please don't use it. Get [URL="http://www.codeblocks.org/"]Code::Blocks.[/URL]

Member Avatar for kvprajapati
-1
87
Member Avatar for sathish.b

[URL="http://www.cplusplus.com/reference/clibrary/cstdio/scanf/"]read this[/URL]. I'm not going to do your homework for you. BTW there is no such thing as "%n" in scanf. The link I give you contains all the valid characters you can put after the % sign.

Member Avatar for kvprajapati
0
88
Member Avatar for thebluestar

You need two loops to do that. You have to check each number against all the previous values. [code] int a[10] = {5,6,7,8,9,10.11,12,13,1}; int i,j,isTrue; isTrue = 1; // assume true for(i = 0; i < 9 && isTrue == 1; i++) { for( j = i+1; j < 10; …

Member Avatar for kvprajapati
0
6K
Member Avatar for eghtedari.amir

either fmod() or modf(), I'm not sure which one you want. Use google and look them up if you don't know what they do.

Member Avatar for Ancient Dragon
0
54
Member Avatar for priteshdesai

First you will need a medical degree so that you know how to recognize a cataract when you see one. My eye specialist had to shine a bright light in my eyes in order to find them. Maybe you can do the same with a color picture -- maybe not. …

Member Avatar for priteshdesai
0
152
Member Avatar for Krstevski
Member Avatar for RobBrown

line 41: That is a horrible way to test for eof -- all you need is this: [code] while( getline(inputFile, line) ) { cout << line << '\n'; } [/code] lines 55-60: WTF??? You can not code nested while loops like that and expect anything other than the results you …

Member Avatar for RobBrown
0
338
Member Avatar for jamesbrad288

use the mod % operator to check of the number is odd or even. When (number % 2) == 0 the number is even. make the data type of [b]number[/b] an int, not a char because you can't enter a number greater than one digit in a char. You will …

Member Avatar for jamesbrad288
0
130
Member Avatar for rmcummings

You are passing vowel incorrectly. The & symbol is used in main to pass vowel by reference, then the * pointer is used in the actual function [code] void generate_random_vowel (char* vowel) { *vowel = 'a'; } int main() { char vowel; generate_random_vowel( &vowel ); } [/code]

Member Avatar for rmcummings
0
189
Member Avatar for rr0

write MS-Windows Device Drivers -[URL="http://en.wikipedia.org/wiki/Windows_Driver_Kit"]- get the DDK here[/URL]

Member Avatar for Ancient Dragon
0
42
Member Avatar for number87

lines 74-80: you don't need to call strcmp() to compare two std::string objects -- just use their == operators [icode] if(type == normal)[/icode] Recode lines 98-105 similarily. Also those if statements will give you a false validity result. Lets say the type is gold. The very first if statement about …

Member Avatar for Ancient Dragon
0
133
Member Avatar for UKmason

Edit your post and use code tags to make it easier to tell you what is wrong with it. For starters, you do not need the two variables called yes and no. What you have to do is check for 'y' or 'n' [icode]if( yn == 'y') [/icode] And remember: …

Member Avatar for alg
0
121
Member Avatar for geg13

put a system pause between letters. Assuming you are coding on MS-Windows. [code] #include <windows.h> ... ... string msg = "This is a test"; for(int i = 0; i < msg.length(); i++) { cout << msg[i]; cout.flush(); sleep(1000); // delay 1 second } [/code]

Member Avatar for geg13
0
117
Member Avatar for sampath kumari

y not? stdio.h is not used in c++ programs, only C programs. conio.h is not recommended because its no-standard and not supported by very many compilers. stdio.h defines FILE structure and associated functions. This is for file read/write. In c++ programs we would use <fstream> instead of stdio.h

Member Avatar for Ancient Dragon
0
34
Member Avatar for luskbo

First problem is that aPtr is declared in the class constructor. It needs to be declared in the class itself so that it can be accessed by other class methods. What is [b]cArray[/b]? You should probably post the class itself so that we can see what you are doing.

Member Avatar for luskbo
0
127
Member Avatar for lllllIllIlllI

[QUOTE=ardav;1005209]Sorry cscgal, saw the up/downs were grey and assumed they were disabled. Why are they greyed out?[/QUOTE] Probably because people were complaining about them being in color. But if you click up or down array the arrow will change color. In another post Dani said we would be able to …

Member Avatar for The Dude
2
861
Member Avatar for Umar Ali
Member Avatar for SuSham
Member Avatar for eggmatters
0
2K
Member Avatar for kustrle

Learn to read [URL="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkbox.aspx"]MSDN articles[/URL] You will have to test each checkbox to determine its state (checked or unchecked)

Member Avatar for kustrle
0
119
Member Avatar for jnick12

Interesting assignment, except for the requirement to use [icode]system("cls")[/icode] to clear the screen. But that's your teacher's problem, not yours. 1) Your validation for months should test if the number entered is less than 1 or greater than 12. If it is, then print an error message and make the …

Member Avatar for Ancient Dragon
0
129
Member Avatar for Mehh

>> pszFileText = LPSTR(GlobalAlloc(GPTR, dwFileSize + 1)); typecast is wrong: [icode] pszFileText = (LPSTR)GlobalAlloc(GPTR, dwFileSize + 1);[/icode] Add this to the top of the *.rc file [icode]#include <winuser.h>[/icode] You have to add comctl32.lib to the list of libraries. For your compiler it probably has *.a extension instead of *.lib.

Member Avatar for Ancient Dragon
0
222
Member Avatar for desimator55
Member Avatar for ashishchoure

After calling CreateProcess() call WaitForSingleObject(). When that returns then you can call GetExitCodeProcess()

Member Avatar for ashishchoure
0
105
Member Avatar for tiara
Member Avatar for Ancient Dragon
0
111
Member Avatar for PoRco1x

how is d_player declared? If it an array of character strings then you may need this: [icode]if( name == d_player[i])[/icode]

Member Avatar for PoRco1x
0
86
Member Avatar for kiryoku

line 6: its [b]int[/b] main(). c++ does not allow default function return types. lines 4 and 5. Move those down so that they are within main() and not global variables. Globals are bad and can normally be avoided. line 10: Entering numeric data types such as integers leaves the '\n' …

Member Avatar for Ancient Dragon
0
98

The End.