Narue 5,707 Bad Cop Team Colleague

compiled using Turbo c++ 3.0 compiler

Have you considered dropping that ancient piece of shit and switching to a compiler that isn't twenty years old and severely limited under modern architectures?

it can't find the factorial of no. grater than six

If this were true I would be confused, but your algorithm is correct and works for values of N greater than six. However, factorials grow at an insane rate, and despite using long double to counteract that growth, you're still going to exceed limits (thus invoking undefined behavior) very quickly.

If you want arbitrarily large factorials, you need some kind of big number library such as GMP.

Narue 5,707 Bad Cop Team Colleague

When a vector is declared to have a certain number of things such as you init it to size(10000) it's very inefficient to init it with a for loop

When the vector is already resized, using a loop to initialize is no different from using a loop to initialize an array. ZeroMemory() or memset() might be faster, but they gain that speed at a cost: throwing away type information and writing bytes in the most efficient manner possible.

The problem with this kind of optimization is many types don't facilitate that kind of type punning. This case is one of them, because memset() fills in all bytes of the object with 0, and that's not required to be an equivalent representation of 0 for type double.

The recommendation for low level stuff like memset(), bzero(), and ZeroMemory() is to restrict usage to arrays of the built-in integer types or POD aggregates of integer types. Anything else, including pointers, is unsafe.

Now for the real kicker: all of this is moot because std::vector's resizing constructor looks like this (simplified for posting):

vector(size_type n, const T& value = T());

When creating a sized vector with the constructor using only the size argument, all of the elements are initialized to the default value for their type. No further initialization is necessary:

std::vector<double> v(5); // All elements initialized to 0.0
Narue 5,707 Bad Cop Team Colleague

You can thank global warming for all but the earthquake.

That's a lie! Global warming is responsible for earthquakes too. Along with (but not exclusive to) excessive cold weather, blizzards, ice storms, volcanos, meteors, tsunami, AIDS, cancer, Alzheimer's, the common cold, homosexuality, missing socks, spelling errors, Barack Obama, fizz overflow on soda pop, teenage pregnancy, and noobs.

Lock up your daughters, here comes global warming!

BitBlt commented: Don't forget about "Not being able to isolate the Higgs Boson". +0
vegaseat commented: humor at its best +0
Nick Evan commented: Ha! :) +0
Narue 5,707 Bad Cop Team Colleague

i say this because using time as a seed, rand() generates the same number for like 2-3 seconds then changes .. causing me a problem...

That's user error. You're probably doing something like this:

int get_random()
{
    srand((unsigned)time(0));
    return rand();
}

It may be less obvious than that, of course, but the underlying problem is constantly reseeding the generator rather than doing it once (or very infrequently).

I'll take a moment to suggest this article on using rand().

Narue 5,707 Bad Cop Team Colleague

Boost.Random would be a good start. Just because rand() doesn't work for you doesn't mean you should write your own version that's better (you'd likely end up with something worse). There are many existing random number generators out there.

i have tried using rand() but i dont like it because the best seed is the time

That's not really an artifact of the generator. What do you think would be a better seed?

and it doesnt generate numbers random enough

I'd love to hear how you determined this. Not that it's an incorrect statement, but a lot of people think rand() is insufficient through hearsay rather than proper testing.

Narue 5,707 Bad Cop Team Colleague

The D.B.A. requires coursework and research beyond the masters degree that normally results in a dissertation or journal publication that contributes to business theory or practice.

You might try actually reading the thread before posting. Or is this an attempt at signature spam?

jingda commented: Maybe;) +0
Narue 5,707 Bad Cop Team Colleague

What is the significance of the letter n or l in these names?

The "n" means that the operation is bound by a character limit, with the limit being remaining available space in the destination (in the case of strncpy() and strncat()), or a partial string count (in the case of strncmp()).

I don't know the etymology of the "l" (note that the strl* functions are non-standard), but like the "n", it means that a character limit is provided to avoid buffer overflow. However, instead of the limit representing remaining available space in the destination, it represents the total size of the buffer, which greatly simplifies usage.

dotancohen commented: Thank you. The word "etymology" is what I was missing when googling. +3
Narue 5,707 Bad Cop Team Colleague

printf returns the number of chars printed, and you didn't print any objects, so it would return a negative number, as an error IF your compiler allowed it to compile.

printf() only returns a negative value if there's an "output or encoding error". Since printf()'s internal loop is essentially skipped when printing an empty format string, neither of those will happen:

int printf(const char *s, ...)
{
    int n_char = 0;

    while (*s != '\0') {
        ...
    }

    return n_char;
}

Thus the return value for printf("") will be 0, and that falls into the else clause of the OP's main().

Narue 5,707 Bad Cop Team Colleague

This is the current draft of C++0x directly from the committee website.

Fbody commented: I did find that link. I thought it was. Thx. :) +13
Narue 5,707 Bad Cop Team Colleague

Then it must become 01100000.Isn't that a +ve number?Each left shift is supposed to multiply the number by 2.But that isn't happening here!

No, that's a positive number. Don't confuse bit shifting with multiplication, especially when it comes to negative quantities.

should b become 00111110 or 10111110 or 11111110(adding 1s to the left)?

That depends on whether the left hand side of the expression is signed or unsigned. If it's signed, the vacated bits are filled with the sign bit. Otherwise, they're filled with 0.

Narue 5,707 Bad Cop Team Colleague

Okay, 'd' instead of 'the' I can understand (I don't agree with it, but I can understand), but WTF is up with omitting 'ee' from "between"? There's a point where being lazy and being a retard come together, and it's generally best to stay away from it when trying to communicate with highly technical people.

Narue 5,707 Bad Cop Team Colleague

Each post has up and down arrows. When clicking on those arrows, you can choose to simply vote or give reputation.

Cap'nKirk commented: A great help. thx +0
jingda commented: Like this:) +0
Narue 5,707 Bad Cop Team Colleague

I tried using libs but some of them seemed to do all the work for me, the others seemed to be too complicated.

How about writing your own version of those libraries? You might realize why doing all of the work for the programmer is a good thing, and/or why so much complication. :)

Narue 5,707 Bad Cop Team Colleague

Your object is not a pointer, so there's no need to use the arrow operator. Also, the [] operator is already dereferencing your pointer, so there's no need for an explicit dereference either:

class myclass {
public:
    int *ptrarray;
    myclass() {
        ptrarray = new int[2];
        ptrarray[0] = 5;
        ptrarray[1] = 10;
    }
};

int main()
{
    myclass a;
    a.ptrarray[1] = 15;
}
sergent commented: yep +5
Narue 5,707 Bad Cop Team Colleague

Dear morons. 400mb ram and 20 gigabytes was unimaginable when C++ was made. At that time 1mb Hdd was too much and ram was less that 256Kb.

check this thread out mate, and if u can modd ur phone, you can probably run Windows 95 on it as well. check it out on youtube, ive done it on my E5 and they did it on an E63. E61i is a very old phone though...

Dear jackass. Please learn to read for comprehension before acting like a jackass. You clearly didn't understand what was written before mouthing off.

Narue 5,707 Bad Cop Team Colleague

"C++ Essentials" by Sharam Hekmat, 14th July 2005

For a book written seven years after the introduction of standard C++, you'd kind of expect the code to use standard C++ rather than pre-standard C++. I'll go ahead and call this book useless for learning modern C++ and only useful for purposes of history.

Narue 5,707 Bad Cop Team Colleague

I'm not a total beginner in my career, just at C# programming work.

Let's not kid ourselves. As far as the employer is concerned, you're a beginner. The PHP experience can be persuasive on a resume, but the headline will be "No .NET experience!". Treat your job search as such, and you'll likely have decent results.

Is it more realistic to just get hired for doing PHP, what I've always done, but at a place that's more open to using different tools, and just learn the new tools/languages at that job?

That's one option, though you risk not hitting your target. That's not to say that a job where you wear a lot of hats won't help, but even in those jobs people still tend to specialize, so you may be plugged into a PHP hole against your will and be right back where you started.

Netcode commented: u're a beginner even with all ur certs +0
Narue 5,707 Bad Cop Team Colleague

Barring an off-by-one error in your array indexing, it works fine on my end.

Narue 5,707 Bad Cop Team Colleague

They say it is done in 2s complement form.

There are several methods of representing signed values in binary. Two's complement is one of the more common on PCs. Others include one's complement and sign magnitude.

Now won't this 2s complement of a negative number clash with an actual +ve number having the same binary representation?

No. Two's complement uses the most significant bit as a sign bit, which effectively cuts the positive range in half. If the sign bit is set, the value is negative, otherwise it's positive. This guarantees that all numbers in the range will have a unique binary representation.

Narue 5,707 Bad Cop Team Colleague

That was a question for a job interview? If you couldn't answer it, I'm inclined to say that you're a perfect candidate. :icon_rolleyes:

Anyway, the expected answer is probably that the for loop is counted and the while loop is not. Though that's only a superficial difference because you can simulate the behavior of either loop with the other.

Narue 5,707 Bad Cop Team Colleague

is there a way to replace a single characters by 2 characters in a string ????

Yes, of course.

I answered linked list, I mean, take each node as a character, so u can easily insert 2 nodes, if u want to replace 2 characters.

That's a very inefficient representation of a string, and your idea wouldn't work for array based strings.

Narue 5,707 Bad Cop Team Colleague

*sigh*

Nick Evan commented: indeed. +16
Narue 5,707 Bad Cop Team Colleague

is it possible to have a back() in stack....i know queue and vector has it...

For the standard container adapter, no. Check any reference and you'll see that the exposed non-boilerplate methods are push(), pop(), top(), and empty(). However, std::stack is an adapter for an existing container (the default is std::deque). If you need more control, simply use the underlying container directly rather than the adapter.

If you think about the abstraction of the data structure, it doesn't make sense to.

On a high level design note, if you have a strict abstraction (just push and pop) then it's not as useful as it could be. Here are some handy dandy stack operations that don't always fit easily into the strict abstraction:

  • Retrieve the top item without popping it.
  • Duplicate the top item.
  • Swap the first and second item.
  • Rotate the top three items.
  • Copy the second item and push it to the top.
  • Copy the top item and insert it underneath the second item.

Not that I'm suggesting a stack library should implement these (or others), but it's important to recognize that as a library author, you don't have to conform to strict data structure definitions if extending them makes the library more useful to your target audience.

Forth is a good example of a stack based language that extends the abstraction in simple yet useful ways.

jonsca commented: Thanks! +14
Narue 5,707 Bad Cop Team Colleague

I may start just deleting posts that fail to use code tags. :@

WaltP commented: Can we? Please? :hopeful: +17
Narue 5,707 Bad Cop Team Colleague

Ok that's looks simple but how?

I wish concurrency were simple.

Can you post an example code?

Sure. With this example I'm assuming your "timer" is actually a timeout for the input. That seems to be the more common situation relative to an ongoing timer separate from the input loop. Since you mentioned _getch(), I'm also assuming that Win32 threads are supported on your implementation:

#include <windows.h>
 
namespace jsw {
    namespace threading {
        class auto_event {
        public:
            auto_event(): _event(CreateEvent(0, false, false, 0)) {}
 
            BOOL wait(DWORD timeout = 1) const
            {
                return WaitForSingleObject(_event, timeout) == WAIT_OBJECT_0;
            }
 
            BOOL set() { return SetEvent(_event); }
        private:
            HANDLE _event;
        };
 
        class thread {
        public:
            static thread start(
                LPTHREAD_START_ROUTINE fn, LPVOID args = 0, 
                DWORD state = 0, DWORD timeout = 5000)
            {
                return thread(CreateThread(0, 0, fn, args, state, 0), timeout);
            }
 
            static void sleep(DWORD milliseconds) { Sleep(milliseconds); }
            static void exit(DWORD exitCode) { ExitThread(exitCode); }
        public:
            thread(HANDLE thread, DWORD timeout): _thread(thread), _timeout(timeout) {}
            ~thread() { CloseHandle(_thread); }
 
            DWORD exit_code() const
            {
                DWORD exitCode = NO_ERROR;
 
                GetExitCodeThread(_thread, &exitCode);
 
                return exitCode;
            }
 
            HANDLE handle() const { return _thread; }
            BOOL is_alive() const { return exit_code() == STILL_ACTIVE; }
            DWORD join() { return WaitForSingleObject(_thread, _timeout); }
            DWORD suspend() { return SuspendThread(_thread); }
            DWORD resume() { return ResumeThread(_thread); }
            BOOL abort(DWORD exitCode) { return TerminateThread(_thread, exitCode); }
        private:
            HANDLE _thread;
            DWORD _timeout;
        };
    }
}
 
#include <iostream>
#include <conio.h>
 
DWORD WINAPI get_key(LPVOID args)
{
    using namespace jsw::threading;
 
    auto_event *e = (auto_event*)((LPVOID*)args)[0];
    int *key = (int*)((LPVOID*)args)[1];
 
    *key …
Narue 5,707 Bad Cop Team Colleague

1- what is the difference between web developer and web coder ?

Terminology.

2- should a web developer study computer science deeply , before starting a career & why?

Why wouldn't they? Sure, web developers are sometimes viewed as short bus window lickers compared to applications developers or systems developers due to the large number of kiddies picking up things like PHP as a first language, but that doesn't mean one shouldn't have a strong foundation in computer science to be a good developer, web or not.

3- what distinguish a web developer from another rather than having wide set of programming languages ?

Knowing languages is a poor way to distinguish developers, because a decent developer can pick up a new language with relative easy. Being a good programmer with good problem solving skills is far more important.

4- how can a web developer starts his career fast and in the right way?

There's no "right" way. Build your skill set, practice, and somehow convince an employer to hire you.

JeffGrigg commented: Very good answers to career development questions. +3
Narue 5,707 Bad Cop Team Colleague

If someone request a B than I'm supposed to print a C. If someone request a C I print D.

What a cynical design. So you'll always assume that the student is lying to get a better grade, always deserves a lower grade, and an A will never be given? :icon_rolleyes:

jonsca commented: How is this pertinent to the question? ;) +14
Transcendent commented: you didn't answer my question but I liked that you tried to help +3
Narue 5,707 Bad Cop Team Colleague

You're redirecting stdin to the pipe, it won't read from the keyboard anymore. If you want to manage both piped data and keyboard data, a better approach is opening the pipe within your program rather than redirecting input from the command line. For example:

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char *argv[])
{
    if (argc > 1) {
        FILE *pipe = _popen(argv[1], "r");
        char buf[BUFSIZ];
        
        while (fgets(buf, sizeof buf, pipe) != 0) {
            buf[strcspn(buf, "\n")] = '\0';
            cout << buf << '\n';
        }
        
        _pclose(pipe);
    }
    
    string input;
        
    cout << "Enter a string: ";
    
    if (getline(cin, input))
        cout << "Output: " << input << '\n';
}

Then call it as C:\>testpipe "type a.txt" .

Narue 5,707 Bad Cop Team Colleague

It looks like you get the concept just fine. The only problems in your code are syntax related (and the poor practice of using conio.h). Fixing those errors produces working code:

#include<stdio.h>
int main()
{
    int counter,howmuch;
    printf("How many numbers do u want to print");
    scanf("%d",&howmuch);
    counter=0;
    while (counter<=howmuch) {
        printf("%d",counter);
        counter++;
    }
}

Though are you sure you're learning C++ and not C? I have trouble imagining a C++ class that starts you off with the stdio library instead of iostream.

Narue 5,707 Bad Cop Team Colleague
Narue 5,707 Bad Cop Team Colleague
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
char name[50]; int i,j;
printf("Enter Name : ");
scanf("%s",name);

	printf("\n%s",name);
getch();
}

And the point of this post is what exactly? You completely failed to answer the question, or solve the stated problem, and you didn't fix any of the other problems in the code. Because I'm such a nice person, and because you (HASHMI007) could probably use it yourself, I'll list all of the issues and explain how they're fixed. You're welcome.

#include<conio.h>

While conio.h is a useful library, the majority of people who use it don't use it correctly. I'd blame bad compiler examples and crappy books from the 90's, but placing blame is pointless at this point in time. The two biggest misuses of the non-standard conio library are:

  1. Using getch() to pause the program before termination.
  2. Using clrscr() to clear the screen on program startup.

The problem with #1 is that there's a standard solution to the problem of pausing the program. With a minor adjustment of pressing any key and responding immediately to pressing the Enter key, getchar() solves the problem just as well without destroying portability:

#include <stdio.h>

int main(void)
{
    fputs("Press [Enter] to continue...");
    fflush(stdout);
    getchar();

    return 0;
}

One argument against the standard solution is that there might be extraneous junk in the input stream. If that's the case, getchar() will terminate immediately rather than block for user input. The most obvious solution is not to leave extraneous junk …

WaltP commented: Cn we use this as a cut'n'paste for all other bozo's? ;-) -- Kidding! +17
Narue 5,707 Bad Cop Team Colleague

I'm somewhat confused about this design. Why make CWorker's constructor a friend of CCar when you can simply construct a new CCar?

#define LEN_N_W 20

class CWorker
{
    char m_name[LEN_N_W];
    CCar m_Car;
public:
    CWorker(const char *name, const char *firma = "",int price = 0);
    void showWorker(ostream& out)const;
};

CWorker::CWorker(const char *name, const char *firma, int price)
    : m_Car(firma, price) // Delegate the work to CCar
{
    strcpy(m_name, name);
}

void CWorker::showWorker(ostream& out) const
{
    out << m_name << ":";
}

Pointers for the sake of using pointers is silly, and your code strikes me as using them unnecessarily. But if you want to continue using a pointer for the member it changes little:

#define LEN_N_W 20

class CWorker
{
    char m_name[LEN_N_W];
    CCar *m_pCar;
public:
    CWorker(const char *name, const char *firma = "",int price = 0);
    ~CWorker();
    void showWorker(ostream& out)const;
};

CWorker::CWorker(const char *name, const char *firma, int price)
    : m_pCar(new CCar(firma, price)) // Delegate the work to CCar
{
    strcpy(m_name, name);
}

CWorker::~CWorker()
{
    delete[] m_pCar;
}

void CWorker::showWorker(ostream& out) const
{
    out << m_name << ":";
}

The real problem that I see is in CWorker::showWorker(). If your ultimate goal is to show the data from m_pCar but can't change CCar, you're kind of screwed because CCar presently only allows CWorker's constructor as a friend, not CWorker as a whole. To give access to m_pCar's members, you'd need to do something truly ugly. For example:

#include <assert.h>
#include <string.h>
#include <iostream>

using namespace std;

#define LEN_N_W …
Narue 5,707 Bad Cop Team Colleague

Why 50? Changing a user's name is quick and easy, provided the new name is available, so I don't see a problem with allowing it regardless of post count. Otherwise those with less than 50 posts would probably create a new account and take up both names, which just clutters the database.

Narue 5,707 Bad Cop Team Colleague

Line 23 will short-circuit if ptr is NULL and hence the CantGetHere() function won't be called, right?

Correct.

Just want to confirm that ||, like &&, always works from left to right.

Yes. Both are short circuited and have left to right associativity.

Narue 5,707 Bad Cop Team Colleague

What does your book say? Did you search google? Have you made any attempt to answer this trivial question on your own?

Narue 5,707 Bad Cop Team Colleague

That's like saying if you can nail two pieces of wood together and they don't fall apart then you are a carpenter.

Your analogy neglects the "and are used" part.

I would have preferred to the the statement amended as

I notice that you didn't change the offending statement that prompted your carpenter analogy.

Personally, I think we should make a distinction between programmer (anyone who programs) and professional (or certified) programmer.

If there were a clear distinction in ability between amateurs and professionals, I would agree. But you can find fabulous amateurs just as easily as atrocious professionals. The only difference is the professionals convinced someone to pay them.

That is, one who has a degree or diploma from an accredited institution indicating that the individual has demonstrated a certain level of proficiency in the field of computer programming.

What about one who's clearly proficient in the field but has no degree or certification?

JeffGrigg commented: Thoughtful and detailed response to questionable posts. +2
Narue 5,707 Bad Cop Team Colleague

You're not doing what you think you're doing, which is set a preprocessor symbol during compilation. Try using a compiler switch instead:

$(GPP) -D UBUNTU -g -c -o Tester_dbg.o Tester.cpp
Narue 5,707 Bad Cop Team Colleague

Or maybe something along the lines of:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main() {
  ifstream infile("input.txt");
  ofstream outfile("output.txt");
  int value;
  while(infile >> value) {
    char mod_val = (--value) % 52;
    outfile << string(value / 52 + 1, 
                      (mod_val < 26 ? mod_val + 'a' : (mod_val - 26) + 'A')) 
            << endl;
  };
  return 0;
};

The only problem being the assumption of adjacent letters in the character set. Only digits are guaranteed to be contiguous. But great minds think alike, because my solution is different from yours only in that I used a custom alphabet:

#include <type_traits>

namespace jsw {
    /**
     * @brief Subtract y from x
     * @remarks Moves in an absolute negative direction while preserving sign
     */
    template <typename T>
    T subtract(T x, T y, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
    {
        return (x >= 0) ? x - y : x + y;
    }
    
    /**
     * @brief Calculates the remainder of x / y
     * @remarks Behavior is sign agnostic (equivalent regardless of sign)
     */
    template <typename T>
    T mod(T x, T y, typename std::enable_if<std::is_integral<T>::value>::type* = 0)
    {
        return (x % y + y) % y;
    }
}

#include <cstdlib>
#include <iostream>
#include <string>

int main()
{
    std::string const buf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    int value;

    while (std::cin >> value) {
        value = jsw::subtract(value, 1);
        
        int const n_wrap = std::abs(value) / buf.size() + 1;
        int const index = jsw::mod(value, (int)buf.size());
        
        std::cout << std::string(n_wrap, buf[index]) << '\n';
    }
}
Narue 5,707 Bad Cop Team Colleague

Who is Dani in this website?

Dani's member name is cscgal.

Where are most of the members of this website from? I think most of you are from India, aren't you?

Members are scattered all over the world.

Why do I see some professional members that have only 1 to 10 posts?

The majority of our members ask one question, get the answer, and don't return. The number of active members (those who post regularly) is relatively small compared to the total number of registrations.

How does it happen that people here misunderstand each other frequently?

Communicating with text is imprecise. You don't have the visual cues from face to face conversation, and the language barrier of non-native English speakers or even differences in education/writing ability can be significant.

Do some feel that others are their enemies??

I have no enemies here, though I'm confident that the feeling is not mutual given my posting history. ;)

jingda commented: Awesome answer +0
Narue 5,707 Bad Cop Team Colleague

What you probably want to do is accept any character in the loop, but only print it if it matches the criteria:

while (cin >> letter) {
    if (is_vowel(letter))
        cout << letter;
}

Obviously this is a non-working example that you would need to flesh out (such as writing is_vowel()), but it should suffice to show the concept.

Narue 5,707 Bad Cop Team Colleague

A command line text editor is vastly simpler, and a good exercise for an intermediate beginner. It continues to be a good exercise as you grow because there are numerous considerations and possibilities when it comes to making the editor faster. But doing a full blown GUI editor with rich text formatting options as a beginner is ridiculous. I suspect our OP has misunderstood the assignment.

Narue 5,707 Bad Cop Team Colleague

So you want to make a text editor, but you don't want to actually do the work?

Stefano Mtangoo commented: You said it well +13
Narue 5,707 Bad Cop Team Colleague

Sorry dude, but we're not sympathetic toward people who go through N years of school and still can't come up with a something as trivial as a topic name. One has to work really hard to be that helpless.

Anuradha Mandal commented: Good. +0
Narue 5,707 Bad Cop Team Colleague

We're not a homework writing service. Please provide proof that you've made an honest attempt to solve the problem on your own.

Narue 5,707 Bad Cop Team Colleague

Your user array can only hold a single character. Since a string ends with '\0', that means it's always going to be empty. Further, using %s in scanf() without a field width means you're not respecting the lack of available space on the array. I'm totally unsurprised that the snippet crashes.

Salem commented: indeed +17
Narue 5,707 Bad Cop Team Colleague

Your request lacks sufficient information, and it reeks of "please do it for me!". I suggest you read our rules, then how to ask a smart question.

Salem commented: indeed +17
Narue 5,707 Bad Cop Team Colleague

I need to know a bit about this "default int" thing in C. What I mean is, is this actually ok and with what version of C is it ok?

main()
{

return 0;
}

As far as I knew this was standard modern C (i.e., no retarded default-int)

int main()
{
return 0;
}

Implicit int was standard prior to C99. Since C95 is still the de facto standard, the first definition of main is still accepted in C circles, but considered bad practice. If you write code that needs to be compatible with C++ or C99, or want your code to be future proof and good style, avoid implicit int.

pseudorandom21 commented: Thanks. +8
Narue 5,707 Bad Cop Team Colleague

Go to Project -> Properties -> Linker -> System -> Subsystem and choose Console.

oltokom commented: it was magic +0
Narue 5,707 Bad Cop Team Colleague

You want a compiler/IDE something that doesn't need to be installed on the host machine. Obviously that excludes Visual Studio. ;) IIRC, Digital Mars is like that. If it's already built, MinGW can be "installed" simply by copying the files (I'd recommend the nuwen build), and for an IDE Code::Blocks nightlies are also install-by-copy.

jonsca commented: I had never heard of the nuwen build, thanks +14
Narue 5,707 Bad Cop Team Colleague

We don't do homework here. If you want help, you'll need to provide more than just program requirements.

Salem commented: Indeed +17