DaniWeb receives about one thirtieth of the traffic we received three years ago and only getting worse.

Yes, but I gather that this has been true about programming fora across the board, for reasons completely unrelated to DaniWeb or its design (e.g., word has gotten out to college students that IT is not a way to get rich with minimal effort, and they have been dropping programing courses in droves, especially in the places where it has been absurdly oversold such as India, China and Russia). Even SO has lost most of its traffic, and most other programming sites (Gamasutra, DevShed) are nearly abandoned. That Daniweb has any traffic at all now is a success.

The irony is that, unlike some fields i.e., medicine, this is actually a good thing for IT. For decades there has been an excess of CSSE students in both universities and trade schools, most of whom have had little inclination to the field but were drawn by the smell of lucre falling from the skies. Worse, as CS enrollment rose, funding fell (or rather, grants were increasingly earmarked for specific projects or purchases rather than general course material), making the schools teach more and more students with fewer and fewer instructors and resources. It has left IT teaching a shambles, doubly so because most of the students didn't really want to be there and had no real desire to be in the field. The result is that the field is now flooded with minimally ...

dtpp commented: dont see what you wanted to tell us...... please explain +0

No, please, don't. That book is a terrible introduction to C++, and does not really cover data structures to any real degree in any case.

Fardous: what do you already know of programming in general, and of C++ in specific? What do you know of data structures in any other languages, if anything? That would help us give you the best advice we can.

Oh? What compiler were you using, and how did you coax it to produce raw binaries?

(On a guess, it was Turbo C, correct? And you simply created a .COM file? That would work, but it would be quite limited.)

I believe this will fix an number of issues with the code:



using namespace std;

void setColor(int color);

int main()
const int SIZE = 5;
double response[SIZE] = {0};
double responseTotal = 0,
responseAverage = 0,
responseHigh = 0,
responseLow = 0;


cout << endl << setw(16) << right << " " << "***********************************"
     << endl << setw(16) << right << " " << "*     Cafeteria Food Survey       *"
     << endl << setw(16) << right << " " << "***********************************"
     << endl << endl << endl
     << "  " << "Enter a rating between 1 and 10:  1=AWFUL 10=EXCELLENT"
     << endl << endl;

for(int index = 0; index < SIZE; index++)

    cout<< endl << "  " << "Rate Cafeteria Food (scale 1 to 10): ";
    cin >> response[index];

    while(response[index] <= 0 || response[index] > 10)
        cout << endl << "  " << "\a\a\aError: Specify a number within a valid range. ";
        cin >> response[index];

// Display the contents of the array
cout <<endl << setw(7) << right << "Rating" << setw(12) << right << "Frequency" << endl << endl;
for(int index = 0; index < SIZE; index++)
    cout << setw(4) << right << response[index]
         << setw(6) << ' '
         << setfill('*') << setw(response[index]) << left << '*'
         << setfill(' ') << endl;

// Display Ratings Average
for(int index = 0; index < SIZE; index++)
    responseTotal += response[index];

responseAverage = ...
WaltP commented: And yet another free code post, with no explanation what the fixes are to boot! Courtesy of the DaniWeb Free Homework Service. -4

The best way to do it is to have an integer variable, initialized to zero, which will hold the number of times the letter appears. You would then have a [url=http://www.cprogramming.com/tutorial/lesson3.html][icode]for()[/icode] loop[/url] going from 0 to 79 (that is, it would continue while the index would be less than 80), and inside the loop you would have a conditional comparing the current array element in [icode]sentence[/icode] to the [icode]letter[/icode]. If the two characters match, then you would increment (add one to) the counter variable.

Well, the first thing you need to know is that [ICODE]getline()[/ICODE] is not a standard C function (as of the C99 standard, at least to the best of my knowledge). It is an extension added in the GNU version of the stream I/O library, and while it is widely supported, it is not necessarily part of any given compiler's library, and is not that widely used.

(There is also a [ICODE]getline()[/ICODE] function in the C++ [ICODE][/ICODE] library, where it is standard, but it is a completely different thing than the C function. If you aren't sure which language the code you're reading is in, then chances are it's C++; post part of it and someone here should be able to tell you.)

The main advantage of [ICODE]getline()[/ICODE] is that it is more secure than, say, [ICODE]gets()[/ICODE], in that it takes a [ICODE]size_t*[/ICODE] argument that indicates the actual size of the buffer the line is being read into, and calls [ICODE]realloc()[/ICODE] to re-size the buffer if the input exceeds the original buffer size (this assumes that the buffer was dynamically allocated in the first place, otherwise it would fail rather atrociously). This ensures that a buffer overrun cannot happen (short of running out of memory entirely), eliminating a common source of bugs and security flaws.

WaltP commented: RTOP! -4

As it happens, the dd utility I mentioned earlier is convenient for this purpose as well, as you can use it to copy individual files into another file which can act as an image file.

Exe2Bin should be part of the MASM package, if you have that, at least it used to be. As I said, I use NASM, which can generate binaries for different formats directly, so I haven't needed that particular utility.

The comment here is incorrect, which may shed light on how the loop is failing as well:
[code]while (in_stream >> number) //in_stream >> number returns a Boolean value of true if the operation has been successful.[/code]
The [ICODE]>>[/ICODE] operators, as a rule, return a reference to an [ICODE]istream[/ICODE] not a [ICODE]boolean[/ICODE] value [I]per se[/I]. Mind you, a non-null pointer should be 'truthy' (that is, it would be treated as a true value), so I would expect the [ICODE]while()[/ICODE] loop to continue indefinitely.

A more typical idiom for this would be
[code] for (int index = 0; in_stream.good(); index++)
in_stream >> number;
array[index] = number;
v.at(index) = number;
// check to see if it stopped because of an I/O error
if (in_stream.fail())
//put error handling code here
Well, OK, it would normally done with a [ICODE]while()[/ICODE] rather than a [ICODE]for()[/ICODE], but in this case it makes for a more compact and integral expression.

mike_2000_17 commented: You're wrong. Check your facts before posting. -3

[B]Dipak Chauhan:[/B] To start off, it is generally considered impolite to re-start an old, existing thread with a new question this way. While what's done is done, please refrain from hijacking threads in the future. Even if the question is more or less the same, when it has been more than a month since anyone has posted in a thread, it makes more sense to start a new thread.

As for the question itself, the answer depends on the compiler and IDE you are using; each IDE has it's own form of project files, so answering questions about them will depend on the system you're using. If you don't already have a compiler available, I would recommend getting either [url=http://www.codeblocks.org]Code::Blocks[/url], which includes the GCC compiler (in the distro marked 'codeblocks-10.05mingw-setup.exe'), or [url=http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express]Visual C++ Express[/url], which is the free version of the Visual Studio IDE and includes the Microsoft C/C++ compiler.

Of course, all you really need are a text editor, a compiler toolchain which includes a version of make or some similar tool, and a shell or command prompt. For most Linux distros, such tools come with the system; for MacOS, you can download [url=http://www.tech-recipes.com/rx/726/mac-os-x-install-gcc-compiler/]Xcode[/url] and have it all set up for you. Under Windows, you can get [url=http://www.mingw.org/]MinGW[/url] and [url=http://www.notepad-plus-plus.org]Notepad++[/url], and you'd be set to go. You would probably learn more this way, and I would recommend at least finding out how to compile a program from the command line, but an IDE makes things far easier for most ...

[QUOTE=jbennet;1635301]He has the choice to go to a real university where they teach you relevant technology........[/QUOTE]
In that case, he'd be studying HTML and either Python or Ruby right now, and we wouldn't be having this conversation (or at least not for another few semesters). While I have used C++ professionally myself, I'd expect that for the current classes of graduates, C++ jobs are the exception rather than the rule.

Seriously, though, when I say 'standardized', I mean it. [i]Every[/i] accredited university in those countries is required to teach the same courses, in the same manner, using the same tools, no exceptions. It's a sad situation, but chances are, the OP doesn't have the choice of going to what you would call a 'real university'.