Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Itself, since PHP is in fact a programming language. One for a specific set of uses, but a programming language nonetheless.

As for which other language it most resembles, that's a bit of a judgement call, really. I would say... well, no, that would be giving you the answer, which I suspect is for a homework question. Given the tags you put, I will say that my personal answer is 'none of those three'.

Mind you, this question doesn't makes much sense as homework, but it doesn't make sense in any other context, either, so I am puzzled as to why either you or your professor would think this is relevant.

Dani commented: Not useful: Yes, it's a judgement call, but you just poke fun at the legitimacy of the question and then refuse to give your opinion -8
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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 …

dtpp commented: dont see what you wanted to tell us...... please explain +0
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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.)

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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

#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdlib>

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;

    setColor(0x1F);

    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
    setColor(0x2F);
    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
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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 for() loop 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 sentence to the letter . If the two characters match, then you would increment (add one to) the counter variable.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Well, the first thing you need to know is that getline() 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 getline() function in the C++ <iostream> 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 getline() is that it is more secure than, say, gets() , in that it takes a size_t* argument that indicates the actual size of the buffer the line is being read into, and calls realloc() 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
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

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.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

The comment here is incorrect, which may shed light on how the loop is failing as well:

while (in_stream >> number)     //in_stream >> number returns a Boolean value of true if the operation has been successful.

The >> operators, as a rule, return a reference to an istream not a boolean value per se. Mind you, a non-null pointer should be 'truthy' (that is, it would be treated as a true value), so I would expect the while() loop to continue indefinitely.

A more typical idiom for this would be

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 while() rather than a for() , 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
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Dipak Chauhan: 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 Code::Blocks, which includes the GCC compiler (in the distro marked 'codeblocks-10.05mingw-setup.exe'), or Visual C++ Express, 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 Xcode and have it all set up for you. Under Windows, you can get MinGW and Notepad++, 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 …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

He has the choice to go to a real university where they teach you relevant technology........

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. Every 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'.