Search Results

Showing results 1 to 40 of 113
Search took 0.17 seconds.
Search: Posts Made By: Dave Sinkula ; Forum: C++ and child forums
Forum: C++ 5 Days Ago
Replies: 6
Views: 298
Posted By Dave Sinkula
Quantity is not always the best criteria for evaluating sources of information.

You might also want to consider:
http://cboard.cprogramming.com/

Not a forum, per se, but I'd also throw in this...
Forum: C++ 9 Days Ago
Replies: 12
Views: 455
Posted By Dave Sinkula
Are you opening the output file in binary mode?

[edit]Another curiosity that I did no investigation of...
ofstream myfile("foo.txt", std::ios::binary);
for ( int x = 0; x <...
Forum: C++ 10 Days Ago
Replies: 10
Views: 800
Posted By Dave Sinkula
Issues when building with mingw:

This includes the cast you've already corrected. So it's mostly just that anonymous struct you may want to look at.

[edit]Also, the necessary library to link...
Forum: C++ 10 Days Ago
Replies: 11
Views: 433
Posted By Dave Sinkula
The thing with using lint is knowing which diagnostic messages you can turn off in general. Stuff that gets repeated hundreds of times and relates to something the programmer verifies is not an...
Forum: C++ 15 Days Ago
Replies: 8
Views: 236
Posted By Dave Sinkula
Or change the scope of i. Remember to return a value. And to initialize sum.
float getAverageGrade (float grades[], int count)
{
float sum = 0;
float average;
int i;
for (i=0; i<count;...
Forum: C++ 16 Days Ago
Replies: 22
Views: 494
Posted By Dave Sinkula
No.

Spot the difference:
cout << (first_name, last_name);
cout << concat(first_name, last_name);
Same thing. Pick your favorite.
Forum: C++ 17 Days Ago
Replies: 6
Views: 355
Posted By Dave Sinkula
Yeah. Some the copying should be done a bit different from what you have. Some ideas:
#include <iostream>
#include <string>
using namespace std;

int main()
{
int count, i, j = 0, k = 0;
...
Forum: C++ 17 Days Ago
Replies: 21
Views: 437
Posted By Dave Sinkula
You can't do this in the declaration:
const double PI = 3.1416;
Initialize PI in the constructor...
class Circle
{
private:
double radius;
const double PI;
public:
Circle(double rad...
Forum: C++ 24 Days Ago
Replies: 8
Views: 387
Posted By Dave Sinkula
How about something along this line?
nclude <iostream>
#include <fstream>

using namespace std;

int main()
{
ifstream iptilvar("ip.txt"); //open filestram
string line, ip;
Forum: C++ 25 Days Ago
Replies: 8
Views: 580
Posted By Dave Sinkula
My assistance has been subpar tonight. Try this:
void loadFileToArray (string namesArray[], double gradesArray[][4], int &numberOfStudents)
{
string filename;
ifstream inputDataStream;

...
Forum: C++ 28 Days Ago
Replies: 3
Views: 246
Posted By Dave Sinkula
Keep track of the index of the highest value while taking input. Initialize to the first element:
int hi = 0;
When you find a new highest value, capture the index:
if ( votes[i] >...
Forum: C++ Nov 15th, 2009
Replies: 11
Views: 579
Posted By Dave Sinkula
That happens to be true for the garden variety PC of today, but it is not true as a generic statement.
Forum: C++ Nov 12th, 2009
Replies: 5
Views: 566
Posted By Dave Sinkula
Use integers.
Forum: C++ Nov 11th, 2009
Replies: 5
Views: 420
Posted By Dave Sinkula
http://groups.google.com/group/comp.lang.c/browse_thread/thread/2aaf5360b08c89a9/1000b1f7fb33ea53?ie=UTF-8&q=float+promoted+double+function+group%3Acomp.lang.c&pli=1
Forum: C++ Nov 9th, 2009
Replies: 3
Views: 309
Posted By Dave Sinkula
#include <iostream>
#include <cmath>
using namespace std;

int main()
{
cout << "RAND_MAX = " << RAND_MAX << "\n";
return 0;
}
Forum: C++ Nov 9th, 2009
Replies: 4
Views: 223
Posted By Dave Sinkula
You can't pass an array by value ("the whole array"). When you "pass an array", you instead pass a pointer to the first element. What I believe you are doing is writing to a random memory location...
Forum: C++ Nov 3rd, 2009
Replies: 6
Views: 661
Posted By Dave Sinkula
Well, choose your poison: multiple passes of the same file, or a single read with a buffer. Both are relatively simple, I'd recommend just examining what's there. Experiment a bit. Learning to code...
Forum: C++ Nov 1st, 2009
Replies: 12
Views: 422
Posted By Dave Sinkula
You're going to return from main in one of two places:
int main ()
{
int number;
int counter = 0;
int flags = 1;
bool flag_none = true;
bool fag_yes = false;

cout << "Enter a number,...
Forum: C++ Oct 27th, 2009
Replies: 7
Views: 248
Posted By Dave Sinkula
Just sayin'.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[])
{
/* Extract value for # of elements in array */
int i;
Forum: C++ Oct 25th, 2009
Replies: 14
Solved: String issue
Views: 393
Posted By Dave Sinkula
for ( int x=0; x<3; x++ );
Do you know what the semicolon does to your intended loop?
Forum: C++ Oct 22nd, 2009
Replies: 2
Views: 241
Posted By Dave Sinkula
template <typename Comparable>
typename LeftistHeap<Comparable>::LeftistNode*
LeftistHeap<Comparable>::merge( LeftistNode *h1, LeftistNode *h2)?
...
Forum: C++ Oct 22nd, 2009
Replies: 6
Views: 404
Posted By Dave Sinkula
You kinda need to know whether the binary contains LE or BE data.

Some somewhat related FAQs:
http://c-faq.com/misc/endiantest.html
http://c-faq.com/cpp/ifendian.html...
Forum: C++ Oct 22nd, 2009
Replies: 9
Views: 750
Posted By Dave Sinkula
Where'd the 28 go and the 20 come from?
Forum: C++ Oct 19th, 2009
Replies: 17
Views: 476
Posted By Dave Sinkula
Some starters: Sort out your confusion about strings and numbers. Assignment is =, comparison is ==. Multiline blocks are not determined by indentation in this curly-brace language.
Forum: C++ Oct 15th, 2009
Replies: 18
Views: 1,069
Posted By Dave Sinkula
And this differs from using push_back with some "default" strings how?

My "Ballpark?" example was how I understood the question neithan was asking:
Forum: C++ Oct 11th, 2009
Replies: 5
Views: 433
Posted By Dave Sinkula
http://wiki.osdev.org/Main_Page
Forum: C++ Oct 9th, 2009
Replies: 18
Views: 1,069
Posted By Dave Sinkula
Ballpark?
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;

int main()
{
Forum: C++ Oct 9th, 2009
Replies: 7
Views: 512
Posted By Dave Sinkula
http://cboard.cprogramming.com/c-programming/56441-can-someone-help-me-understand-example-program.html#post394525
Forum: C++ Oct 8th, 2009
Replies: 5
Views: 405
Posted By Dave Sinkula
http://david.tribble.com/text/cdiffs.htm
Forum: C++ Oct 8th, 2009
Replies: 3
Views: 200
Posted By Dave Sinkula
else if ( delta == 0 ) // compare, don't assign!
Forum: C++ Oct 6th, 2009
Replies: 6
Views: 339
Posted By Dave Sinkula
Here is an old example I'd forgotten about; it may be of some use with regard to splitting a standalone chunk of code into header(s) and source file(s):...
Forum: C++ Oct 5th, 2009
Replies: 6
Views: 339
Posted By Dave Sinkula
Sooner or later you'll need to learn that this is the wrong thing to do. Generally you want to put the interface (class definition, function prototypes, etc.) in the header, and put the...
Forum: C++ Oct 3rd, 2009
Replies: 6
Views: 470
Posted By Dave Sinkula
Folks might find it helpful if you'd post "Plot.h".
Forum: C++ Sep 9th, 2009
Replies: 4
Views: 278
Posted By Dave Sinkula
If you made a toy program in which you printed val in hex and then the resulting tmp in hex, do you think it would shed some light on it?

[edit]Hm. Maybe not. It doesn't look like the greatest...
Forum: C++ Sep 8th, 2009
Replies: 8
Views: 475
Posted By Dave Sinkula
The first suggestion worked dandy for me, starting with the code you posted. I'd recommend trying the suggested remedies again.
Forum: C++ Aug 31st, 2009
Replies: 5
Views: 417
Posted By Dave Sinkula
Maybe observe the output first?
#include <iostream>
#include <fstream>

int main()
{
std::ifstream file("file.txt");
std::string line;
while ( getline(file,line) )
{
Forum: C++ Aug 29th, 2009
Replies: 35
Views: 1,683
Posted By Dave Sinkula
(Q1) No. AND is not used to toggle a bit, it is used to clear a bit.
0 0 0 1 1 0 0 1
& 1 1 1 1 1 1 1 0
---------------
0 0 0 1 1 0 0 0
If the last bit were already a zero, it would not...
Forum: C++ Aug 28th, 2009
Replies: 9
Views: 451
Posted By Dave Sinkula
No subtraction, it's error checking.


man localtime (http://www.google.com/search?q=man%20localtime)

man mktime (http://www.google.com/search?q=man%20mktime)
man ctime...
Forum: C++ Aug 25th, 2009
Replies: 35
Views: 1,683
Posted By Dave Sinkula
Since it seems to be lingering: 16 decimal is 10 hex, which is 10000 in binary; 15 decimal is 0F hex, which is 1111 in binary.
Forum: C++ Aug 22nd, 2009
Replies: 16
Views: 483
Posted By Dave Sinkula
Since I don't see the problem with the one set of code, I'm wondering if it's in the other. Do you see the blank line when you open "appointment.txt" in an editor? Or when you're working with the...
Showing results 1 to 40 of 113

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC