15,300 Posted Topics

Member Avatar for chemicaldave

line 12: you are attempting to use [b]string[/b] as both c++ object type and a variable name. You have to rename it to something else line 13: why are you using character arrays here? You can just use std::string class [code] string fileword, fileline; [/code] The loop that starts on …

Member Avatar for Ancient Dragon
0
335
Member Avatar for zidaneqrro
Member Avatar for Sky Diploma
0
83
Member Avatar for zidaneqrro

It is not necessary to state [icode]std::cout[/icode] on every line -- most programmers code a using statement at the top [code] #include <iostream> using std::cout; int main() { cout << "Hello there.\n"; cout << "Here is 5: " << 5 << "\n" cout << "The manipulator std::endl"; cout << "writes …

Member Avatar for osirus0830
0
120
Member Avatar for blah70

>>I have an assignment due tomorrow So why did you wait so long before starting it? You can't be a procrastinator in computer programming because its probably the most time consuming course you will ever take in college.

Member Avatar for ithelp
0
95
Member Avatar for pakman31

The problem is the way you formed that while loop -- it reads the last entry in the file twice. Here is the correct way to code it. Notice that eof() is not necessary. [code] while(empFile >> thisSalary) { emp[i].setSalary(thisSalary); //assigns to the array cout << emp[i].getSalary() << endl; //for …

Member Avatar for Ancient Dragon
0
6K
Member Avatar for savinki

>>Could anyone tell me about what are the test cases i should do? Test everything.

Member Avatar for Ancient Dragon
0
54
Member Avatar for drajairtt

depends -- what compiler are you using. If Microsoft they are installed with the compiler. VC++ 2005 Express you will need to download the Windows Platform SDK to get them, which is a huge download.

Member Avatar for Ancient Dragon
0
51
Member Avatar for nemoUSA

how about this: [icode] cout << setw(40) << left << "John" << setw(40) << "Smith" << "\n";[/icode]

Member Avatar for Ancient Dragon
0
100
Member Avatar for loeto

It would be nice to know what this program is intended to do. It is trying to convert pounds and shillings to something, but I don't know what.

Member Avatar for loeto
0
171
Member Avatar for alkeshtech

If you use the vector class you don't have to know how many words there ahead of time. Just read the file once and add each word to the vector -- it will expand as necessary to contains all the strings [code] #include <vector> #include <string> #include <fstream> #include <iostream> …

Member Avatar for Ancient Dragon
0
130
Member Avatar for jimJohnson

1)[icode] 3 2 8 7 1 5 6 0 0 0 0 0 0 0 0[/icode] The reason for all those 0s at the end is that the compiler will initialize any unspecified array elements with 0 as long as there is at least one initializer Example: [icode]int array[15] = …

Member Avatar for Ancient Dragon
0
84
Member Avatar for Spagett912

Either you are using a crappy compiler or you did not post the current code: [b]ticTacToe.cpp[/b] >>TicTacToe::ticTacToe() Spelled wrong. [b]TicTackToe.h[/b] missing the constructors referenced in the *.cpp implementation file. I'm giving up now.

Member Avatar for Ancient Dragon
0
112
Member Avatar for lahom
Member Avatar for CBnewbie

The easiest was is not to put the duplicates in the array in the first place. When you read a city name from the file check to see if the name is already in the array. If not, then add it.

Member Avatar for VernonDozier
0
2K
Member Avatar for saadmalik

>>while(1); That's an infinite loop >>void main() Not a good thing to do. [URL="http://www.gidnetwork.com/b-66.html"]Here's why[/URL]. The function just above main is missiong a closing }

Member Avatar for Prabakar
0
99
Member Avatar for sirplex

Welcome to DaniWeb. Sounds like you are really enjoying yourself in Cambodia :)

Member Avatar for jbennet
0
161
Member Avatar for dreamon

[QUOTE=caperjack;598794]don't get mad, get even ,throw out the computer ! .[/QUOTE] Don't laugh -- I did that once. I got to angry that I tossed the computer, monitor and all books out the back door and smashed it all on the concrete patio! I felt great after doing that :)

Member Avatar for caperjack
0
111
Member Avatar for deathevan

For MFC stuff you should get familiar with [url]www.codeproject.com[/url] because they have hundreds of free MFC programs you can use as examples. A search for treeview got over 100 hits. Also there are [URL="http://www.google.com/search?hl=en&q=mfc+treeview+tutorial&btnG=Search"]several tutorials[/URL] on the net

Member Avatar for deathevan
0
137
Member Avatar for c++ newbie

look at the function parameters and then look at what you are trying to pass. There apparently are some difference. I'd say you're trying to pass a pointer where its not supposed to be a pointer, or vice versa.

Member Avatar for Ancient Dragon
0
66
Member Avatar for alban08

I think menu Project --> Add To Project, then select the library you want to add. Could be wrong about that though.

Member Avatar for alban08
0
135
Member Avatar for tillie

[QUOTE=jasimp;597367]Welcome! Stephen King is the greatest author of the 20th century. I am a slight addict to his works. Besides The Dark Tower, IT is the greatest thing he has written.[/QUOTE] [URL="http://users.erols.com/mwhite28/top100s.htm#Novels"]Others will disagree [/URL]with that.

Member Avatar for Ancient Dragon
0
65
Member Avatar for briansmall

[QUOTE=briansmall;536787]What is ... the most important thing you pursue?[/QUOTE] Getting my afternoon nap :)

Member Avatar for ZZucker
0
560
Member Avatar for light_handle

>>int position should be [b]size_t[/b] position because negative positions are not valid and size_t will allow for files twice the size (about) as int. >> char word[] use std::string here to avoid the many problems with character arrays. use a vector instead of that huge array because vector will expand …

Member Avatar for Ancient Dragon
0
63
Member Avatar for BigFormat

its not necessary to use strtok() to get the filename part. Just call [URL="http://www.cplusplus.com/reference/clibrary/cstring/strrchr.html"]strrchr()[/URL]. This is a safer way to do it because strtok() requires non-literal strings and the function below doesn't. [code] char* get_filename(char *path) { char* ptr = strrchr(path,'/'); if( ptr != NULL) ptr++; return ptr; } [/code] …

Member Avatar for BigFormat
0
1K
Member Avatar for lahom

>>Could someone please tell me how can i open a txt file with a press of a button (MFC)? In the OnClick() event handler for the button. >>Is there any way i can transform a cpp file to a txt file No conversion needed -- the *.cpp file is already …

Member Avatar for lahom
0
149
Member Avatar for daviddoria

1) when using vectors you can access individual elelements just as you would do with a simple int array [icode]B = LiDARGrid.ConcentricScans.[scancounter].getColumn(concentriccol);[/icode] Otherwise, this works. Your problem is probably something other than push_back [code] #include <vector> #include <iostream> using namespace std; int main() { vector<double> Saved; for(int i = 0; …

Member Avatar for mitrmkar
0
192
Member Avatar for The Dude

Scooby, Road Runner, the Jetsons, Underdog, were and still are my favorites. Yes, even at my ags, I still watch cartoons occasionally :)

Member Avatar for Sulley's Boo
0
103
Member Avatar for midimatt

>>i close the file and reopen it to get back to the start of the file (not the best way i know) Just call [b]rewind()[/b] function or [b]fseek()[/b] >>if(strncmp(line,"v",1)== 0) using strncmp() like that is too time consuming. Since the letter you want is at the beginning of the line …

Member Avatar for Prabakar
0
118
Member Avatar for hjfast

[QUOTE=thekashyap;598593]also I didn't know C++ allowed type names to start with numbers.[/QUOTE] It doesn't :)

Member Avatar for Ancient Dragon
0
92
Member Avatar for spaceboy

[QUOTE=majestic0110;595620]That is odd, I had no experience of this and have been on and off most of the day lol[/QUOTE] That's because you live in the wrong time zone. The term "this morning" doesn't really mean much because for you in UK "this morning" is "last night" where I live. …

Member Avatar for thunderstorm98
0
168
Member Avatar for EBC

delete main() out of stack.cpp and everything links ok for me. Using VC++ 2008 Express. Do you have stack.cpp part of our compiler's project ?

Member Avatar for EBC
0
210
Member Avatar for larryeis

That code won't work because it is an error to cast an int pointer to a float pointer. The two objects have to be the same size, and int is not the same size as a float. If you need to pass something with decimal places to a function then …

Member Avatar for Prabakar
0
94
Member Avatar for winky

Its probably the way you created the project. [URL="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3084692&SiteID=1"]This link[/URL] suggests you start with an empty project. You might also read some of [URL="http://search.microsoft.com/results.aspx?mkt=en-US&form=MSHOME&setlang=en-US&q=c1010070&x=3&y=7"]these links[/URL].

Member Avatar for winky
0
93
Member Avatar for alkeshtech

just use getlin() to get each line [code] #include <sstream> // <snip> std::string line; int lines = 0; int words = 0; while( getline( inFile, line) ) { lines = lines + 1; // now split line into words stringstream str(line); string word; while( str >> word) { words = …

Member Avatar for Ancient Dragon
0
237
Member Avatar for nmprof

I tried to submit the answers to the questionaire about 5 times and apparently failed each time. So I gave up.

Member Avatar for Ancient Dragon
0
72
Member Avatar for henpecked1

Here is an example [code] // create instance and use default constructor sphere obj; // create another instance but specifiy the radius int radius = 20; sphere obj1(radius); // now change the radius radius = 21; obj.setradius(radius); [/code]

Member Avatar for bugmenot
0
152
Member Avatar for Black Magic

you can write your program with notepad but you can't compile it because notepad is not a compiler. If your school computers don't have a compiler then ask one of the teachers if they will download it for you.

Member Avatar for Ancient Dragon
0
249
Member Avatar for mussa187

>>compare and index or argv to i. I suspect you misunderstood your assignment.

Member Avatar for Radical Edward
0
3K
Member Avatar for umeshjaviya

line 27, you have to pass the pointer CF5 by reference, you are only passing it by value. I only show the corrections to a few lines. Function resize_long_pointer() will require several other corrections to accommodate the double star (pointer to a pointer) [code] // line 13: void resize_long_pointer(long *[color=red]*[/color],long …

Member Avatar for Prabakar
0
97
Member Avatar for chrisfrolich
Member Avatar for The Dude

Cool :) I'll have to try that tomorrow. >>none of your links ever work for me, i always get white screen Move to USA where you will be closer :)

Member Avatar for kdoiron
1
104
Member Avatar for joshmo

>>detailsPtr head; That is an uninitialized pointer. Set it like this and everything should work. [icode]detailsPtr head = NULL;[/icode]

Member Avatar for joshmo
0
61
Member Avatar for bhaSD

[quote=Salem]You are likely to be ignored, or written off as a loser, if you [list] [*]cross-post to too many different newsgroups [/list] [/quote] Yup.

Member Avatar for Ancient Dragon
0
486
Member Avatar for asad awan

>>reply plz plz in two days i have to submit it in 4days That is your problem, not ours. How long have you had that assignment ? What are the requirements ? "A budget for an office" could mean almost anything.

Member Avatar for Salem
0
145
Member Avatar for Jigg1yPuff
Member Avatar for lahom

Do you mean [URL="ms-help://MS.VSCC.v90/MS.msdnexpress.v90.en/dv_vbalr/html/6e55faae-d32f-4038-9b21-245e25399dba.htm"]this function[/URL] ? Not exactly -- use ifstream declared in <fstream> file and its >> operator or getline() function to read data into a variable. [URL="http://www.cprogramming.com/tutorial/lesson10.html"]Here [/URL]is one of many tutorials you can find on the net

Member Avatar for lahom
0
263
Member Avatar for jk_bscomp

All three do the same thing but in different ways -- ODBC is the oldest and best supported method of accessing an SQL database. It is supported by virtually every SQL database and 32-bit c/c++ compiler. The other two originated at Microsoft. [URL="http://en.wikipedia.org/wiki/OLE_DB"]OLEDB[/URL] and [URL="http://en.wikipedia.org/wiki/ADO.NET"]ADO[/URL]

Member Avatar for Ancient Dragon
0
68
Member Avatar for Saaddani
Member Avatar for En1ro

No tutorial because each compiler does it differently. I don't know how Borland Builder 6 does it -- you should ask someone in the Borland support forums.

Member Avatar for mitrmkar
0
591
Member Avatar for akshayygarg

>>program is running fine from the tc I guess that means Turbo C compiler ? Sounds like the csv file is not where you think it is. Check to see that it is located in the same directory as the *.exe file. If not, then did your program specify the …

Member Avatar for akshayygarg
0
157

The End.