15,300 Posted Topics

Member Avatar for wardensmat08

When you enter an integer the program leaves the <Enter> key '\n' in the keyboard buffer so the next getline() will just extract it instead of waiting for more keyboard input. You need to flush that '\n' out of the keyboard buffer after the [icode]cin >> age[i];[/icode] One way to …

Member Avatar for wardensmat08
0
174
Member Avatar for jesseb07
Member Avatar for wavsyntax

You don't need those loops in readb() and writeb(). All it takes is one line of code, using fread() and fwrite().

Member Avatar for niXman
-1
100
Member Avatar for apo

The parameter to open() has to be a null-terminated character array (commonly called a string). All you are trying to send it is a single character. Try this: [code] [color=red]int[/color] main() { int i; char* letras[3] = {"a","b","c"}; for(i=0;i<3;i++) { ofstream print(letras[i]); } } [/code]

Member Avatar for niXman
-1
186
Member Avatar for abhaymv

line 48: it is not reading the value of [b]n[/b] from the data file. You need to put [icode]f >> n;[/icode] between lines 47 and 48. delete line 49 because that's the default when files are opened for reading. line 50 should be this: [icode]file.read((char*)B,sizeof(books));[/icode]. The value of [b]i[/b] is …

Member Avatar for abhaymv
0
193
Member Avatar for jaggs_astro
Member Avatar for samsons17

didn't your instructor tell you where that IC number comes from? AFAIK there is no online database of IC numbers.

Member Avatar for ithelp
0
843
Member Avatar for razo

we don't do homework for you, but we will help you if you have specific questions. Post what you have tried.

Member Avatar for VernonDozier
0
113
Member Avatar for razo

You need to try to do that yourself. We are not here to do your homework for you. If you don't know how to do it then just read your text book that you bought when you signed up for that course.

Member Avatar for razo
0
138
Member Avatar for godsgift2dagame

Read the file one word at a time, instead of one charcter at a time. If the word contains digits then convert the entire word to int so that "10" becomed 10. line 10 should be an array of ints, not an array of char, so that it can contain …

Member Avatar for godsgift2dagame
0
186
Member Avatar for cole davidson

you will need to declare an array of ints that hold the individual test scores so that they can be averaged later. Then pass that array to the function to computes the average. Declare and allocate the array between lines 11 and 12 of the code you posted. [icode]int* arry …

Member Avatar for cole davidson
0
614
Member Avatar for mehmood_ahmed

Your description of the problem is somewhat unclear. What does "and as how many times user" mean? >>i have written some code, please see it and correct it : What is wrong with it? Are you getting compiler errors? If yes, then what errors? And what compiler?

Member Avatar for mehmood_ahmed
0
80
Member Avatar for yatman

Here is one way to do it [code] #include <string> #include <sstream> using namespace std; int main() { string s = "Adder: 4, yes"; stringstream str(s); string m; int n; bool b; str >> m; // "Adder:" str >> n; // 4 str >> m >> m; // extract comma …

Member Avatar for Ancient Dragon
0
78
Member Avatar for Carrots

If you want to do it as a function then pass the string by reference [code] void addDoubleQuotes(std::string& str) { str = '\"' + str + '\"'; } [/code]

Member Avatar for Carrots
0
5K
Member Avatar for kent01981

I don't see anything wrong with it -- but did you post exactly the same thing that is in your program? Maybe you need to post more of the program.

Member Avatar for kent01981
0
297
Member Avatar for gcardonav

lines 12 and 13. You can not allocate or delete those arrays yourself. If you want to clear out the values then just set them all to 0. memset() is the quickest way to do it, but there are other ways too. [icode]memset(series_number, 0, sizeof(series_number));[/icode] And before anybody complains, yes …

Member Avatar for Ancient Dragon
0
186
Member Avatar for chaybird001

1) First off I assume you are an American because that's American currency you have to deal with. If not, then you might have a problem. 2) Second, I assume you know how to make change. If you owe me 25 cents and give me a 10.00 bill, how much …

Member Avatar for Ancient Dragon
0
156
Member Avatar for CaptainMack

[QUOTE=CaptainMack;262238] Well the homework i have been given was to design and make a program that would convert binary code into a denary integer also backwards from denary to binary code. I have done a bit of research through the internet, and i have seen some simple programs just by …

Member Avatar for sneekula
-2
235
Member Avatar for caprio.nups
Member Avatar for David49

I made a couple attempts to install Office 97 on 64-bit Windows 7, and the both failed because some of the DLLs could not be registered. After installing the basic Office 97 from CD, I tried to install SP1, and it failed due to DLL registration problems. So I tried …

Member Avatar for 04ayasin
0
388
Member Avatar for wangatang126

>>However the array dosent show What does that mean? And please use code tags.

Member Avatar for neithan
0
158
Member Avatar for mymyzzz

Of course there is. Just use the stream's >> operator [code] int n; ifstream in("filename.txt"); in >> n; [/code]

Member Avatar for pecet
0
159
Member Avatar for lotrsimp12345

line 9, my_vector.h [color=red]NEVER EVER[/color] include a *.cpp file in a header file. It doesn't work. You didn't say what compiler you are using but you have to compile all *.cpp files and then link the object files together to make a single executable program.

Member Avatar for Dave Sinkula
0
144
Member Avatar for cjf90

It doesn't work on modern MS-Windows operating system. Those escept codes are intended for Win95 and MS-DOS Version 6.X and earlier which had ansi.sys device driver installed. ansi.sys has not been in use since probably Windows NT 4.0. [URL="http://support.microsoft.com/kb/101875"]See this [/URL]Microsoft article.

Member Avatar for cjf90
0
121
Member Avatar for johndoe444

c++ does have standard libraries and a whole set of standard header files. There are at least a hundred or so of them. Look in your c++ compiler's installation directory and you will find the libraries stored in the lib directory and header files in the include directory. The directory …

Member Avatar for johndoe444
0
127
Member Avatar for jmoran19

>>so it's potentially got multiple leading zeroes, which will be lost in the conversion process from int to string to int. What's the problem with that? Integers never contain leading zeros, whether the strings have them or not. What I would do is convert the three integers into seconds so …

Member Avatar for jmoran19
0
102
Member Avatar for discovery-power

My bet is that the window is closing before you have a chance to see the output. The reason is that when you enter numeric data the program will leave the Enter key '\n' in the keyboard buffer, and when cin.get() is called it just retrieves it. When you need …

Member Avatar for discovery-power
0
96
Member Avatar for Bips123

Bips: how did you ever get the silly idea that you can run a program written 20+ years ago for MS-DOS on a *nix box??

Member Avatar for Ancient Dragon
0
140
Member Avatar for freddyvf
Re: help

how would you connect to what? How do you compile it? You have to use a compiler. Two free ones are Code::Blocks and VC++ 2008 Express.

Member Avatar for Ancient Dragon
0
54
Member Avatar for raigs

>> If I compile a simple Hello World! program on a 64bit linux, will it work on a 32bit linux? Depends on the flags you give the compiler. The default is to produce 32-bit code, but you can tell it to produce 64-bit code. Just because you are running a …

Member Avatar for ankur_
0
173
Member Avatar for lovely ari

You need to clearly define terms, such as "sentence", "atomic sentence", "conjunction", etc. Don't just assume we know what those terms mean.

Member Avatar for lovely ari
0
114
Member Avatar for coud_ren_26

Forget Vista and upgrade to Windows 7. But you will have to do a clean install, not an upgrade. Backup all files you want to save before starting because Windows 7 installation will reformat the hard drive. But if you insist you must upgrade to Vista, just put the Vista …

Member Avatar for hughv
0
173
Member Avatar for desiguru

Your program doesn't have to open the file, the operating system redirects the file contents to stdin of your program, just as if you are typing the data from the keyboard. Get your program working while typing the data on your keyboard, then when that works ok just run it …

Member Avatar for Ancient Dragon
0
68
Member Avatar for Talguy

line 83 is wrong [code] void removeElement(std::vector<std::vector<std::string> > &Mat, std::string El) { [color=red] std::vector<std::vector<std::string> >::iterator [/color] ITx = Mat.begin(); for(; ITx<Mat.end(); ++ITx) { std::vector<std::string>::iterator ITy = ITx->begin(); for(; ITy<ITx->end(); ++ITy) { if(*ITy == El) { ITx->erase(ITy); } } } } [/code]

Member Avatar for Talguy
0
564
Member Avatar for kesh1000

The 2d linked lists I have worked with in the past is really nothing more than a linked list within a linked list. Something like this: I have not done it using templates. [code] struct node { struct node* next; void* data; struct node* head; // head of another linked …

Member Avatar for Ancient Dragon
0
98
Member Avatar for bliya123

switch() is just swapping the variable addresses (which are local to switch funcction), instead of the values stored at those addresses [code] void switch(int* x, int* y) { int hold = *x; *x = *y; *y = hold; } [/code]

Member Avatar for Ancient Dragon
0
103
Member Avatar for r430t

right click the IE icon in the task bar, then from the popup menu select "Internet Explorer", near the bottom of the list.

Member Avatar for caperjack
0
242
Member Avatar for ab00120

You can do this [code] class test { public: std::string write(); }; std::string test::write() { std::string name = "HELLO"; return name; } int main () { test A; cout << A.write() << endl; return 0; } [/code]

Member Avatar for ab00120
0
96
Member Avatar for vishme

This has to be one of the dumbest polls I have seen in my four years here at DaniWeb.

Member Avatar for Ancient Dragon
-1
63
Member Avatar for Ancient Dragon

I installed Windows 7 this morning, then installed VC++ 2008 Express again. Now I want to install a dependency walker in its installation folder. But suprise suprise, the folder is marked read-only. Using Windows Explorer to change permissions does nothing. Yes, my account is set up as Administrator (already checked …

Member Avatar for Ancient Dragon
0
204
Member Avatar for Excizted

1) Are you compiling for UNICODE? 2) what compiler 3) how is UPDATE_DIR declared 4) note that %s and %S are not the same thing. [URL="http://msdn.microsoft.com/en-us/library/hf4y5e3w%28VS.80%29.aspx"]See this[/URL]

Member Avatar for Excizted
0
239
Member Avatar for pspwxp fan

Better still, uninstall that IDE/compiler and use Code::Blocks with current version of MinGW compiler.

Member Avatar for pspwxp fan
0
278
Member Avatar for SCoder1

>>if (the number is a character) //don't quit get that You will need to get the number in a char variable, not an int variable. Then the above line will make sense because you need [icode]if( !isdigit(character)) [/icode] maybe this will make more sense [code] #include <iostream> using namespace std; …

Member Avatar for SCoder1
0
97
Member Avatar for kat_stephens

What problem are you having? You need to post the code you have tried. If you have not started yet, why not? Do the program in small steps -- do the first part first. When that is finished and tested, then move on to the second part.

Member Avatar for kat_stephens
0
81
Member Avatar for ninreznorgirl2

>> while( k != isalpha(ch) || k != MAX_DIGITS) The problem is that line. Why test for k != isalpha(ch) ? The loop counter has nothing to do with the value of ch. And if you type fewer than MAX_DIGITS then the next cin.get() will wait for you to enter …

Member Avatar for Lerner
0
135
Member Avatar for ylchen

MS-Windows: Sleep(int milliseconds) *nix: sleep(int seconds) There is another one too that takes milliseconds but I don't recall its name. In MS-Windows you can call WiatForMultipleObjects() to put the main thread to sleep until all worker threads have finished. You don't need that loop at all.

Member Avatar for Ancient Dragon
0
89
Member Avatar for Nixriq

When using random numbers there is no guarentee you will get 5 heads and 5 tails.

Member Avatar for Clinton Portis
0
132
Member Avatar for kingcrim05

If you only enter one argument then argv[2] is invalid. The program will only have argv[0] and argv[1].

Member Avatar for Ancient Dragon
0
118
Member Avatar for Ancient Dragon

[URL="http://www.stumbleupon.com/s/#2aDeft/ellen.warnerbros.com/2009/10/big-ash-twitter-1023.php/"]Got this link [/URL]from twitter -- theEllenShow

Member Avatar for vegaseat
0
23
Member Avatar for chetangudi

Just use a linked list of stacks. Are you using a structure to represent the stacks?

Member Avatar for Ancient Dragon
0
28

The End.