deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In C++ you can certainly pass an array directly by reference:

#include <iostream>

using namespace std;

void foo(int (&a)[10])
{
    for (int i = 0; i < sizeof a / sizeof *a; ++i)
    {
        cout << a[i] << '\n';
    }
}

int main()
{
    int x[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    foo(x);
}

However, that's not suitable as a solution because this is clearly not a real array we're talking about (unless you depend on a compiler extension) since its size depends on runtime information. Arrays in C++ must have a compile time constant size. Also, when passing an array by reference, the argument size must match the parameter size. An array of size 11 is incompatible with an array of size 10, for example.

Remi, post your code so that we can see what you're talking about. It's possible you're using C instead of C++, or relying on a compiler extension, both of which change the best solution for your problem.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Are the DaniWeb registration passwords hashed and salted?

Yup.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

When a's destructor is not virtual and either b's or c's IS virtual, the program crashes. I'm not sure why this one happens.

I don't know off the top of my head, but I'd guesstimate that this invokes undefined behavior somehow and crashing was the result.

When a's destructor virtual and b's and c's destructors are not virtual, all three destructors are called. This one is really puzzling me.

Virtualness is inherited whether you specify it or not. Because a's destructor is virtual, b and c inherited that trait and are also virtual.

Finally, is there ever a time when you would not want to define all three destructors as virtual?

If none of the classes are used polymorphically, there's no need for virtual behavior. But I'd probably question a deep inheritance hierarchy that doesn't use abstract classes as the bases.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

OKAY YOU NOOBS!!!!!
HERE IS A MUCH SIMPLER THING TO DO!!!!

It's also subtly broken if you care about uniform distribution. Simple isn't always better...noob. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

When testing sort routines visually I'll usually use a before and after printout:

void quick_sort (int *a, int n) {
    if (n < 2)
        return;
    int p = a[n / 2];
    int *l = a;
    int *r = a + n - 1;
    while (l <= r) {
        while (*l < p)
            l++;
        while (*r > p)
            r--;
        if (l <= r) {
            int t = *l;
            *l++ = *r;
            *r-- = t;
        }
    }
    quick_sort(a, r - a + 1);
    quick_sort(l, a + n - l);
}

#include <stdio.h>

void display(int* a, int size, int field_width) {
    int i;
    for (i = 0; i < size; ++i) {
        printf("%*d", field_width, a[i]);
    }
    putchar('\n');
}

int main () {
    int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
    int n = sizeof a / sizeof a[0];
    display(a, n, 4);
    quick_sort(a, n);
    display(a, n, 4);
    return 0;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I suppose the optimal type would be the one std::vector exposes for you:

std::vector<T> v;

...

// Use the provided size_type
for (std::vector<T>::size_type i = 0; i < v.size(); ++i)
{
    ...
}

That's rather verbose, so you can hide it behind a typedef prior to C++11, or use auto to figure out the type in C++11:

std::vector<T> v;

...

// Use the provided size_type
for (auto i = 0; i < v.size(); ++i)
{
    ...
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Markdown is shit. Period.

I'm sorry you feel that way.

I know you want to be hard headed and say your system is better because obviously you designed it/made it and we are all proud of our creations but Im sorry to tell you this but it is horrible.

It is what it is, I'm not saying it's better or worse than other forums. If there are bugs, I'm willing to fix them. If you don't like the system and refuse to compromise in any way, there's not much I can do. Who's being hard headed here, the one open to making improvements to the current system or the one who only wants vBulletin back?

If you made this new posting system from scratch, Im sure you can make something to fight against those spambots.

Yes, and we did. The massive spam attacks that Daniweb was suffering for the better part of last year have halted completely.

That being said, it really hasnt done anything because I still receive daly spam in my PM (which I dont from much larger forums than yours)

I can't do anything unless you report it. Please forward an example or two of those PMs to me and I'll take a look.

I just wish both of you rethink the current system and implement something way better because I think I mentioned it that it because so difficult to sometimes post, that I just close the …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

"Help me please" is not a good question. Please be specific about what you want help with. I'd also recommend reading this tutorial on how to ask a smart question.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Initially, this was a quick and dirty way to do this, and worked well, but it's turning out to be quite unwieldy now with all the if-statements. I'm sure there must be more intelligent ways of doing this.

It's funny that right as I hit the "huge list of if-statements" part of your description, my first thought was: why not a table driven approach? That's not always suitable depending on the complexity of your processing logic for each parameter, but it's generally superior in maintanability to a long chain of if statements or a switch statement with umpteen cases:

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

struct Action
{
    string parameter;
    string value;

    Action(string const& init)
    {
        istringstream iss(init);

        // Error checking omitted for brevity
        iss >> parameter;
        iss >> value;
    }
};

// Set up desired actions
//
void Add(string const& value) { cout << "Adding '" << value << "'" << endl; }
void Modify(string const& value) { cout << "Modifying '" << value << "'" << endl; }
void Delete(string const& value) { cout << "Deleting '" << value << "'" << endl; }

// Set up a table of actions and conditions
//
struct ActionLookup
{
    const char* parameter;
    void (*run)(string const&);
};

ActionLookup lookup[] =
{
    {"add",    &Add},
    {"modify", &Modify},
    {"delete", &Delete},
};

const int nLookup = sizeof lookup / sizeof *lookup;

int main()
{
    ifstream in("test.txt");
    string line;

    while (getline(in, line))
    {
        Action action(line);

        // …
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My theory is that those libaries are needed for those 'built-in' functions and that those libaries do not exist on my system.

Yup. Your only two options are to find libraries that implement the functions being called, or simulate the functionality by writing definitions for those functions manually.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how the compiler searchs for a file when we write fopen("filename","r");

It doesn't search, you give it a specific file name. As far as relative paths, that's fairly standard behavior in that the system (not the compiler) will attempt to open the specified file in the current working directory.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Turning off the wysiwyg preview below the editor and the live wysiwyg in the editor itself may be an attractive feature.

The problem presently is that disabling the live preview would cause formatting issues due to disconnects between how the editor does highlighting and how the live preview/final result do it. Another issue is Markdown can be somewhat finicky with "complex" formatting such as quoted code blocks, nested lists, or code blocks as a list item. While I agree the live preview is confusing given the highlighting of the editor, I also think it's somewhat necessary.

Another possibility is a preview request instead of a live preview, kind of like we had before. Maybe more AJAXish, but still on request as opposed to always there when you're working with the editor.

I'd also be interested in going with something closer to raw text in the editor and keeping the live preview. Or, since Dani doesn't like that idea at all, at least make it optional. But off the top of my head, that seems tricky. I have an idea of how to do it, but I'm not confident that it'll work without some testing. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Here is a great example: I click in the quick reply box and it automatically pastes what I had copied on my clipboard which has your post. That isnt NORMAL in any forum and is annoying most of the time. Give a option to allow this type of actions OR, just maybe, do like every other forum and allow it to be turned off and have the user MANUALLY put in the tags.

I'm down with providing the auto-quote feature as an option, if Dani approves.

Why when I type a math formula such as 2 * 2 does everything become italics? Again NOT NORMAL*

You might want to read up on Markdown formatting. Note that we switched from BBCode to Markdown, and * is the starting character for italics. If it bothers you in the editor, you can escape that character with a backslash and it won't be highlighted.

Try putting /**/ and then something between. The cursor does some weird next line stuff. And this is all bolded what Im typing when the post isnts in bold

Once again, read up on Markdown. Double asterisks are the starting sequence for bold. And once again, you can use a backslash to escape the starting sequence so that it won't be highlighted in the editor.

Why cant I use tags like [QUOTE][/QUOTE] Why does the first quote turn blue and the second turn red? Quoting Rainbow Man: What does it mean?

Markdown …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Sounds good to me.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So, I understand your code. But, how would I implement the member functions?
By how, I mean do I create my own implementation or use the implementation provided in the adaptee class?

You say you understand my code, but your question suggests otherwise. Clearly the member functions are implemented by calling relevant functions from the adaptee. Usually this is just a simple call as in my code. Sometimes it's multiple calls, but you're not rewriting anything that the adaptee already does.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

An adapter is really nothing more than a wrapper around another class that exposes a specialized interface. So at its simplest, a stack might be implemented like so:

template <typename T>
class Stack
{
public:
    bool empty() const { return _data.empty(); }

    void push(T const& x) { _data.push_back(x); }
    void pop() { _data.pop_back(); }

    T const& top() const { _data.back(); }
    T& top() { _data.back(); }
private:
    list<T> _data;
};
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Ahh I fixed the run-time error but the compile time still happens

Whoops. I forgot to mention that I also changed the specialization from char* to const char* to fix the compile time error. My bad.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
bool Contains(const char* LiteralType, bool CaseSensitive = true);

This declaration doesn't need to exist at all. const char* is already handled in your specialization of the overload for T. So remove that entirely and the compile time error will go away. However, you'll still have a runtime error from this:

std::vector<std::string> TempData;
for (size_t I = 0; I < TypeData.size(); I++)
    TempData[I] = TypeData[I];

Notice how the vector is never properly resized, yet you still try to access an index. Replace that with a call to push_back() and you'll be golden.

triumphost commented: Thank you! Much Appreciated. +5
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I can't reproduce the error because too many things are missing. Can you boil it down into a small and complete program that's compilable as-is? Also, what compiler are you using?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

After doing so I was told by poojavb that I was breaking daniweb rules.

I'm not 100% sure that poojavb was referring to the cross post link, but regardless I don't see anything wrong in that thread. If you ever have any questions about interpretations of the rules or if you've done something you think might be a violation, don't hesitate to contact myself, happygeek, ~s.o.s~, or any of the moderators. We'll be happy to clarify things for you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I don't understand what the big deal is about linking to crossposts on other sites though.

There's no problem with linking to other sites/forums as long as it's an informative and relevant link that isn't spam. What gave you the impression that such things aren't allowed on Daniweb?

If you're talking about someone who posted a question on one forum and then links to that thread on umpteen other forums before getting an answer on any of them, many people find this practice offensive. The similar practice of copy-pasting a question on every forum one can find is also often considered extremely rude, and could potentially violate our copyright rule depending on how the other forums claim ownership of post contents.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

About the reply box, I find it annoying to use. First, it's too small. Second, I see no point to the supposed "preview" below; it looks exactly the same, and the movement is distracting. Third, contrary to what you said, it does not seem to show what the post will look like. (I experimentally bolded, and it showed up as italics.)

The editor should grow vertically as you type (or paste). Are you talking about the horizontal size? There have been complaints that it doesn't match the size of the post window, though I'm not sure if Dani has gotten to that in her list of things to do. Or it may be that the editor and live preview boxes aren't easily made dynamic, since the post window is relative to your browser's current width.

Would you mind sending me a PM with that bold/italic experiment? While the font may be inaccurate if you're in the middle of typing due to the boundary characters not being complete, the live preview and final result should match exactly once everything is formatted for submittal.

The editor itself is my current headache. We're using CodeMirror as the back end for the editor, and it's finicky at best. ;) I've been working feverishly to bring the editor's highlighting in line with the live preview and final post, but it's somewhat slow going.

The problem with the word "articles" is that it already means something. For most of us, I think it …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

ifstream doesn't have a copy constructor. Rather, it's declared private prior to C++11 and declared deleted in C++11. Either way, you can't copy stream objects in any generally useful manner, so it's truly awkward to use them as a return value. I was pushing you toward a different solution entirely, specifically using an output parameter:

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

using namespace std;

char getOption();

bool openInputFile(ifstream& strm)
{
    string fileName;

    cout << "Please enter a valid file name: ";
    cin >> fileName;

    strm.open(fileName);

    return strm;
}

int main()
{
    char userOption;
    ifstream fileInUse;

    do
    {
        userOption = getOption();

        if ((userOption == 'i') || (userOption == 'I'))
        {
            if (!openInputFile(fileInUse))
            {
                cerr << "Error opening file\n";
            }
        }
    }
    while ((userOption != 'q') && (userOption != 'Q'));
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In proper socratic fashion I'll ask you this: what happens to an ifstream object when it goes out of scope?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

sscanf(puppy,"%[^|]%f", &p, &num);

Try this instead:

sscanf(puppy,"%[^|]|%f", p, &num);

You forgot to extract the pipe character. Not to mention that the address-of operator is unneeded on p because it's already a pointer to char.

hanananah commented: Thank you! +0
Sokurenko commented: nice one, always happy to learn from u +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i am sorry decepticon if i have hurted you

I'd be very impressed if you could manage to bother me at all, much less hurt me in any way. I really care very little about what you say or do, but it's my job as a moderator and administrator to enforce the rules.

i am demanding this huge amount of money to keep my mother happy

Please read our rules concerning spam. By the way, since it's devolved into little more than a sales medium for you, I'm closing this thread.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I couldn't reproduce the error on dev and had to sherlock the fix. Are you sure strict warnings are enabled?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've been getting that one too on Chrome 19/Windows 7 64-bit. Note that it was present before you put my Markdown changes in place, so no worries that the recent update introduced that particular bug. ;)

It seems to be a rezising issue, but I haven't yet encountered it on Chrome 20-beta/Windows 7 32-bit. I also haven't been using Firefox, IE, or Safari often enough for serious posting to see it there either.

Yeah, so my post is really just to say that I've gotten it too, but it wasn't caused by the recent Markdown mode changes. :D

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Look into how qsort() works, as that's the solution for C. However, C is very inadequate for dynamic typing, so you'd probably be better off looking for a different implementation language or ditch the "accept any type" option in favor of something better suited to C.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've committed a fix to our code repository. It should make it to production pending Dani's approval. Thanks for the report. :)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Here, in the call to the function, what are we passing as an arguement, is p is here a char pointer or a char ** ??

In the first call the argument is char*. In the second call it's char**. An important difference to note is with multidimensional arrays. Consider the following code:

char a[M][N];
func(a);

Due to the law of decaying pointers, one might mistakenly think that the argument type is char**, but in reality only the first dimension of the array follows the law, which means the actual type is char(*)[N] (a pointer to an array of N).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Remove conio.h and _getch and it should compile for you.

If you can remove parts of a program without affecting it's functionality or usefulness, were those parts really needed in the first place? ;)

But no, it won't compile for anyone who's not using Visual Studio. Even then, Visual Studio users would need to have precompiled headers enabled for the project (note that I always disable them). Another compiler-specific part of the code is sprintf_s(), which is part of Microsoft's "safe" strong library. Your code is closely tied to your compiler, but it's also easily made more portable:

/* Given a palendromic start date 2001/10/02 
   calculate the next 10 future date palendromes. */

#include <stdio.h>

#define STRINGLENGTH 19

long jd(int y, int m, int d);
void gd (long JD, int *y, int *m, int *d);
int IsPallendrome (char Date[]);

int main(void) 
{
    int Year, Month, Day, count;
    long Julian;
    char d[20];

    Year = 2001;
    Month = 10;
    Day = 02;

    count = 1;
    Julian = jd(Year, Month, Day); /* Seed the start date with the Julian date */
    for(;;)
    {
        gd(Julian,&Year, &Month, &Day);  /* convert Julian to Gregorian */
        sprintf(d,"%4d%02d%02d\n", Year, Month, Day); /* make date string */
        if(IsPallendrome(d))        /* test for palendromw */
        {
            printf(" %d: %s is a Palendrome\n",count,d); /* yay we found one */
            count += 1;
            if (count > 10) break; /* found enough? */
        }
        Julian += 1;  /* bump julian and look more */
    }

    return 0;
}

/* Gregorian to …
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm curious, will I always have to type in an answer to a questions just to post or is this a noob action that I must do until I hit a certain number of posts?

It's an anti-spam measure. It'll go away quickly as the requirements are very lax: 15+ reputation points or 5 posts + 5 days since joining.

Stuugie commented: Thanks for the info! +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

First, why does this not cause a stack overflow?

I'd wager that the empty function call was optimized away. You might be able to turn off all optimization switches in your compiler and get it to overflow.

Two, What is the difference between the two below?

The first is direct recursion and the second is indirect recursion. Direct recursion is when a function calls itself, and indirect recursion is where a function is called recursively by a different function that it calls. They're still both recursion, and can still both overflow the stack if not capped by a base case.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

IIRC, auto-watching is enabled by default upon registration. I'm also not aware of any special cases that would exclude threads older than a certain time span. Now, while I could certainly be wrong since Dani was the last one to have a finger in that particular pie, if the behavior seems wrong to you, please don't hesitate to report it as a bug (with reproduction steps if possible).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I use win 7, 64-bit, mingw with Eclipse.

I don't know what to tell you except hope for someone who can reproduce the issue. I get the same correct results with MinGW (g++ version 4.6.0). Unless you've got a buggy version of g++ (highly doubtful), something else is going on. But it's extremely difficult to troubleshoot problems that cannot be reproduced. :(

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is yours the most recent reply on this threads?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your program works, just doesn't work correctly. The sort is wrong, you need to add the third parameter to std::sort and write a comparison function that returns bool value.

That's unnecessary if the class overloads operator<(), which in this case it does.

EDIT: This is what the print parts show me... considering the input objects sort by the 3rd value... it is not sorted at all.

Once again, I'm getting correct results. What compiler and operating system are you using? Here's the compilable code I'm using to test on Visual Studio 2010, Windows 7 64-bit:

#include <algorithm>
#include <fstream>
#include <iostream>
#include <vector>

#include <cstdlib>

using namespace std;

class RAngle{
public:
    int x,y,l;
    RAngle(){
    }

    RAngle(int i,int j,int k){
        x=i,y=j,l=k;
    }

    bool operator<(const RAngle& rhs)const
    {
        if(l < rhs.l){
            return true;
        }
        return 0;
    }

    friend ostream& operator << (ostream& out, const RAngle& ra){
        out << ra.x << " " << ra.y << " " << ra.l;
        return out;
    }

    friend istream& operator >>( istream& is, RAngle &ra)
    {
        is >> ra.x;
        is >> ra.y;
        is >> ra.l;

        return is ;
    }
};

void descrSort(vector <RAngle> &l){
    for(unsigned i=0; i<l.size();i++){
        cout<<l[i]<<endl;
    }

    cout << "==================" << endl;

    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());

    for(unsigned i=0; i<l.size();i++){
        cout<<l[i]<<endl;
    }
}

void readData(vector <RAngle> &l){
    RAngle r;
    ifstream f_in;

    f_in.open("test.txt",ios::in);

    for(int i=0;i<10;++i){
        f_in >> r;
        l.push_back(r);
    }
}

int main(){
    vector <RAngle> a;

    readData(a);
    descrSort(a);
}

And here are the contents of the file "test.txt":

1 7 31
2 …
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It seems to work on my end (noting that I removed readData() and built the vector manually). Can you post some sample data that exhibits the problem?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

erm i learn new thing, its a bad idea to use "using directive" inside a class declaration, because this can leads to ambiguous functions/statements inside the main program.

That argument only applies if you reuse standard library names, which generally isn't a good idea in the first place. While I don't disagree entirely with the advice to limit using directives, I think you should avoid the underlying problem instead of Band-Aid it.

the question is, is it okay to use "using declaration" inside a class declaration?

It's better in that you have more control over which names from the library are exposed. The using declaration lets you choose names onesie twosie while the using directive will pull in everything whether you want it or not.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

As further apology, here's one possible solution:

#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    float a, b, c;
    float s;
    float Area;
    char answer = 'y';

    while (answer != 'n') {
        cout << " Please enter the lengths of the three sides of a triangle " << endl;
        cin >> a >> b >> c;

        s = (a + b + c)/2;
        Area = sqrt(s * (s-a) * (s-b) * (s-c));

        cout << " The area of the triangle with sides : " << a << "," << " " << b << "," << " " << "and" << " " << c << " " << "is" << " " << Area << endl;
        cout << endl << endl;

        cout<<"Do you want to calculate the area of another triangle (y/n)? ";
        cin>>answer;
    }

    cout<<"Have a nice day"<<endl;

    return 0;
}

In your original code the loop was basically infinite, so you need some way to break out of it. The value of answer is one option which I used above. Just make sure that answer has an appropriate starting value and you're golden.

Also note that the = operator is for assignment. It may have been a typo, but confusing = and == is a very common and often disastrous bug.

Cheers!

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Gaack, I'm sorry. I accidentally killed your code when I changed this article from a code snippet to a discussion thread. Would you mind posting it again as a reply?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You pretty much nailed it for a simple class. It gets quite a bit more complex when construction, destruction, inheritance, polymorphism, and especially multiple inheritance enter the picture.

A good book covering the topic is this one.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You'll want to convert both a and b to strings, concatenate them, then convert the result back to an integer. Here's an example using string streams:

#include <iostream>
#include <sstream>
#include <string>

using namespace std;

int main()
{
    int a = 4;
    int b = 5;
    ostringstream oss;

    oss << a << b;

    istringstream iss(oss.str());
    int c;

    iss >> c;
    cout << c << endl;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Deceptikon, I think webecedarian is referring to this. Dani said she added this effect.

Ah, I see. My bad.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Well, today in Opera 11.64 I discovered that when text is selected and then clicking the editor, the pasting appears stuck in a loop (pasting 63 quotes).

I was able to reproduce the issue and pushed a fix to our staging environment. It's now pending Dani's approval.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why does it keep erasing what I'm writing?

That certainly shouldn't be happening. Can you provide reproduction steps as well as your browser and operating system (including full version numbers)?

Why is there a window underneath with the same text?

That's the live preview, it shows what your post will look like after you submit it.

Why when I click to reply on the last page does it give me a different form?

Could you post up some screenshots?

And, by the way, why don't you have a "quote" mechanism, in case there's a reference to something specific in a long thread?

Our quoting mechanism is totally unintuitive if you're used to other forum, but it's otherwise very natural. Simply select what you want to quote from the original post, then click into the reply editor and the selected text will be pasted in with Markdown quote tags.

2.Instead of one Geek forum (maybe not the best name), what if you had one forum for sheer off-topic sociability, but another one for issues related to tech/internet? For instance, a forum where people could discuss the politics of internet regulation or the ethics of Wikileaks? I rarely come for real tech-talk, but that might make me stop by more often.

The Geeks' Lounge is our Misc forum. Perhaps it's not the best name, but that's what we've used for the last ten years. ;)

3.For small tweaks, I'd stop calling …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why dont we use '&' in the case of strings in function scanf ??

e.g. :-

scanf("%s",date);

here date is a character arraymeans string.

Because date is already a pointer in this case. There's no need to add another level of indirection with the address-of operator.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Technically the only thing C supports is pass by value. You can simulate pass by reference using a pointer and dereferencing it, but the pointer itself is still passed by value.