~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

If you are working with C++ and your application really demands high precision and range why not try out some third party libraries like these:

http://www.nongnu.org/hpalib/
http://www.tc.umn.edu/~ringx004/mapm-main.html
http://cliodhna.cop.uop.edu/~hetrick/c-sources.html

Though these libraries require you to study them before you use them, they are worth the effort.

HOpe it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

To achieve a difficult task and make a complete software is not easy as it appears and due to teh complexity it is bound to contain advanced concepts so that the software can be realized. If you have the desire to make a software you have to study hard to make it happen. Just asking for something to happen the easy way just doesnt click right. Before creating anything its better you do a reality check.

If you still feel that you can create a text editor software with the knowledge you possess, then best of luck for your project.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It is not called not writing into the files, as mentioned by me earlier, it is called undefined behaviour when the file stream is kept open.

Undefined behaviour can imply successful write as well as an unsuccessful write, but cant be determined when that happens. Use the funtion int ferror (FILE* file_ptr) to check whether the file stream is corrupted or not.

HOpe it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Its normally a rule of the thumb to close the file pointer as soon as you are finished with it to avoid the undefined behaviour of the file stream which you have opened. Even if you dont close the file stream, they are automatically closed when your program exits but is regarded as a bad practice and may cause subtle bugs due to the corruption of the open file stream. Hence better close the file stream as soon as you are done wiht it rather than waiting for them to be automatically closed.

And btw file poitner returning valid integer as you say means that the file pointer exists and is pointing to the file currently opened but doesnt necessarily guarantee defined behaviour.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I have to use a variable of type double to store and manipulate a value for an amount of years. This means I have to ensure that the data input by the user is an integer. The program will accept a non-integer value, but I want it to continue reprompting the user when a non-integer is entered. I thought I had this solved, but it does not work for some reason. Here is the code:

The first step in solving the problem is to properly understand the problem domain and the prog requirements. IF you just want to accept and manipulate a value for amout of years why not just use unsigned long instead of going to the trouble of using a floating point variable which always ditches the programmer when it comes to comparing it with some other floating number.

Do a second check on you logic, as suggested by Mr. Andor. It would definately solve your problem. Otherwise if you still want to stick to floating point types then you have to follow the advice given by Mr. Infarction which involves deciding on a tolerance value or the deviation value by which your two floating point numbers can differ.

HOpe it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Please seperate your code into logical functions and modules then point out to us which section or logical part is not working as you expected. Giving out such a huge code as Mr. Andor said will not attract much attention. Try localising the problem and then repost. Localised errors in a logically modular program are easy to find out than finding them from a large chunk of data. And btw dont forget to use the code tags while posting code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe something like this which will implement a basic AND logic will help you understand the thing better:

int main ()
{
    bool first [] = {true, false} ;
    bool second [] = {true, false} ;

    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            cout << boolalpha << first [i] << "  AND  " << second [j] << "  =>  " << (first[i] && second [j]) ;
            cout << endl ;
        }
    }
    return 0 ;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A C++ compiler, an IDE and a GUI toolkit like the GTK+ which can be used for creating the user interfaces. This should be the bare minimum to get you started with.

BTW dont expect a source code or any help of that kind from here since we can only answer your queries but cant provide you automated homework help.

Best of luck for your future endeavours, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

In regards to the how do 'I delete a line from the file problem',you should know that deleting doesn't actually exist.

Rather, you give the illusion of deletion by:-

1. copying the contents of the original file into memory,
2. change the a variable of that file whilst in memory,
3. erase the original file,
4. then write a new file with the ammendments and then rename the new file with the name of the original one.

Wont this present problems if the file is really large like those real time log files or data files. It would be really better if you read a chunk or a logical structure of data from the original file and keep on writing it to a new file and skip those records which you want to as such delete as you say. After this operation if finished the original file can be overwritten with the new one or deleted.

just my point of view, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Try using an global variable instead of passing one

Yes i completely agree with Mr. Grunt, passing global variables is not the best programming practice around. And to suggest this to someone who has just started programming is not a good thing since they dont know the side effects or bad effects associated with them.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

i have the program which i wrote by myself... i juz wanted know whether anybody have good idea abt it...

If possible please post your code so that we can have a good loook at it and then try to help you in any way possible.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Type the code exactly as i am typing and then try to run it

#include <stdio.h>

int main (void)
{
    printf ("\nHello to you newcomer") ;
    getchar () ;
    return 0 ;
}

Repost if you get any errors.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe you are a bit confused between Programming and Scripting languages, though the demarkation is a bit fuzzy but Scripting langs are meant to be simplify the task of the programmer and carry out repetitive tasks in an automated and easy manner. They have inbuilt automatic garbage collector. They are mostly interpreted languges (no object file is formed). Some egs are the famous Perl, PHP, Python etc.

C, C++, JAVA are programming languages in the way that they require a compilation phase before the execution phase.

The program which you have written in your first post can easily be compiled and run on any of the compilers present in the link given to you by Mr. Ancient Dragon. So download the compiler and IDE and try running the code. If you still face problems then repost.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I really wish people would stop saying crap like this. It does make a difference whether large or small. It's just wrong. Period.

Err.. typing mistake maybe, what i wanted to say was:
"For small programming exercises it may not make a difference for you"...
and the you here is the one who thinks writing clumsy code doesnt make a difference but surely not me.

And by the way i am a proponent of methodological development and good design.

Hope it cleared away the misunderstanding.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why not try something else which also supports "mouse" as you wanted:
Here is list of some free compilers and IDE which you may find really good and programmer friendly:

http://www.daniweb.com/techtalkforums/thread50370.html

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes i completely agree with Mr. WaltP, since old habits die hard. For small exercies it doesnt make a difference, but in the long run it causes a lot of problems. Correct methodology coupled with technical accuracy can only be achieved only if you try for it and want to learn new each day.
Otherwise its the same thing like many people who learn such things the hard way. (eg. building a 3d Game using an external engine).

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Then maybe you are looking for something along the lines of "Ternary Trees" which are used in games like Scrabble and solving crosswords which also require wildcard matching. Maybe you would want to look here:

http://www.cs.princeton.edu/~rs/strings/

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Why not just try to complete the assignment in Turbo C. In the help section of turbo C there is a small tutorial which explains how to setup graphics in Turbo C along with a small example.

And just copy pasting the files wont do the job coz Turbo C is not the same as Borland C++, i hope you get the point.

Maybe you can look here
http://www.daniweb.com/techtalkforums/thread11617.html
and
http://bdn.borland.com/article/16170

Hope it helped, bye.

Salem commented: Are we at 5 yet? - Salem :) +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

How about starting with this:
http://www.daniweb.com/techtalkforums/thread50370.html

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The best data structure to keep track of millions of record (i mean there is no such best but still...) B Trees.
B-Trees are specifically designed for managing indexes on secondary storage such as hard disks, compact discs, and so on, providing efficient insert, delete, and search operations. Like binary search trees, B-Trees contain nodes. Unlike binary search trees, however, the nodes of a
B-Tree contain not one, but multiple, keys, up to some defined maximum—usually determined by the size of a disk block. The keys in a node are stored in sorted order, with an associated child node holding keys that sort lower than it—every nonleaf node containing k keys must have k+1 children.

So if poss you can try to implement a class for B-Trees since they exhibit excellent performance where numerous records are concerned. Most Databases like MySQL also use some kind or variation of B+ Trees.

An implementation for ur reference can be found here:
http://www.cse.mrt.ac.lk/lecnotes/cs5224/Assignment5/Assignment5/index.html

Hope it helped, bye.[IMG]file:///C:/DOCUME%7E1/sos/LOCALS%7E1/Temp/moz-screenshot-1.jpg[/IMG]
[IMG]file:///C:/DOCUME%7E1/sos/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hi Guys,

Almost forgot. Is there any C function that I can use to extract valid words form a string or I have to do it using something like strtok() to remove spaces and any special characters. Thanks again.
harry

If you are talking about removing field separators and repacing them with spaces then you can do something like this:

#include <stdio.h>
#include <string.h>
#define LINE_BUF  100

int main()
{
  char  line[LINE_BUF];
  char *sep;

  while (fgets(line, LINE_BUF, stdin))
  {
    sep = line;

    while (sep != 0)
    {
      // search for the given chars and if found store 
      // its ptr in sep. Then they can be changed using
      // dereferencing sep. 
      sep = strpbrk(line, ";.&:,");
      if (sep != 0)
        *sep = ' ';
    }
    fputs(line, stdout);
  }
  return 0;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

unsigned int a =0xffff;
~a;
printf("%x",a);

gives output ffff

Complementing function works here.

What's use of 0x in 0xffff as unsigned int is of 2 bytes only???

Can anybody suggest???

Correction: size of unsigned int on normally all machines is 4 bytes that is 32 bits. Only that you specified "ffff" doesnt mean that the variable can take only four f's.

Also complementing function doesnt work since you dont store teh result.

And the 0x in front of the number is to specify that the contents of variable is a hexadecimal number (maybe wrong grammar).
Similarly its a '0' for octal numbers.

Run this code to get a better understanding.

int main (void)
{
    unsigned int n = 0x0000 ;
    printf ("\nThe size of unit is %d", sizeof (unsigned int) ) ;
    n = ~n ;
    printf ("\n%x", n) ;

    return 0;
}

HOpe it helped, bye.

[edit] Heh looks like Mr. Infraction was a bit too fast for me ;) [/edit]

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe you are talking about an internet bot. They can be used for both malicious and normal purposes , so what exactly you thinking about :P

Even google uses a Bot known as google bot to extract the detailed information from the website when you search for somthing in google.

And as far as your original question is concerned, Perl i think is best for such things though you can even do it in C or any similar lang.

Some info here.
http://www.answers.com/topic/internet-bot

HOpe it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes, i think maybe you are wokring on a 16 bit compiler like Turbo C. Move on to some newcompiler and try your code then. If still error persists post here.
Look for the list of free IDE and compilers here.
http://www.daniweb.com/techtalkforums/thread50370.html

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I'm new to these forums,and really new to C++,but here is what i need to know.I made a simple calculator in C++ and i was wondering what i need to be able to keep useing it without opening the program everytime...

// simple calc
// Chris Wilson
#include <iostream.h>
int main()
{
    float first;
    float second;
    float oper;
    float output; 
 
 
 
    cout << "|--------------------|\n";
    cout << "|-----Chris_Calc-----|\n";
    cout << "|--------------------|\n";
    cout << "|---------by:--------|\n"; 
    cout << "|----Chris_Wilson----|\n"; 
    cout << "|--------------------|\n"; 
 
    cout << "Would you like to:\n";
    cout << "1)add\n";
    cout << "2)subtract\n";
    cout << "3)multiply\n";
    cout << "4)divide\n";
    cin  >> oper;
    if (oper==1)
    {
                cout << "enter a number to add\n";
                cin  >> first;
                cout << "enter another number to add\n";
                cin  >> second;
                cout << "you get\n";
                output = first + second;
                cout << output <<endl;
    }
    if (oper==2)
    {
                cout << "enter a number to subtract\n";
                cin  >> first;
                cout << "enter another number to subtract\n";
                cin  >> second;
                cout << "you get\n";
                output = first - second;
                cout << output <<endl;
    }
    if (oper==3)
    {
                cout << "enter a number to multiply\n";
                cin  >> first;
                cout << "enter another number to multiply\n";
                cin  >> second;
                cout << "you get\n";
                output = first * second;
                cout << output <<endl;
    }        
    if (oper==4)
    {
                cout << "enter a number to divide\n";
                cin  >> first;
                cout << "enter another number to divide\n";
                cin  >> second;
                cout << "you get\n";
                output = first / second;
                if (first > second)
                cout << output <<endl; …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes what Mr. WaltP has said pretty much clarifies the situation. If you still need to know some functions which will help you in achieving your task then:

1. Read the current line in a string "currentLine".

2. Let the contents be eg. <p>Here is my content</p>.

3. Find the occurance of ">" which marks the end of the starting tag, the position of the "<" which marks the start of the ending tag.

4. Extract the data between the indexes found using the above procedure.

You can try out the foll code snippet:

int main (void)
{
    int a;
    char temp[] = "<p>hello to all</p>" ;
    printf ("%s", temp) ;
    char* my_string = temp ;
    my_string = strpbrk( my_string, ">" ) ;
    my_string ++ ;
    int index = strcspn (my_string, "<") ;
    my_string [index] = '\0' ;
    printf ("\n%s", my_string) ;
    return 0 ;
}

My output:

<p>hello to all</p>
hello to all
Press ENTER to continue.

Though not a very good representation, i just churned that out in some spare time, it will help you understand the basics.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yeah there are many out there, and all the tools that supprt 3d modelling support the .X file format. But all of them may not be for free. THe one which i mentioned, blender is a free tool which has gained a lot of recognition but if you can spend money then definately go for 3DS MAX or MAYA which are the best in the industry for such purposes.

Maybe HERE you will find some free tools.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

When new pointers are created they point to a random location in memory, more like nowhere. It doesnt have to be necessarily an integer variable. Just keep in mind that you cant rely on the value of uninitialized or the pointers which point nowhere. Any attemp to access the value pointed by these variables will give you a junk value and any attempt to modidy that location which doesnt belong to you will give you a run time error.
So a better programming practice is to ground the pointer variables newly created like this:

int main (void)
{
    int* p = NULL ; // ground the pointer var
    int val = 10;

    p = &val; 
    // pointer now points to the "value" or has the addr of 
   // "val" as its value.

  return 0;
}

At the end of program execution:

eg.
Content of val = 10
Address of val = aabb0034
Content of p = aabb0034
Addr of p = some_arbitrary_value

Hope it helped, bye.

PS: main returns an int like mentioned by me above.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Ternary, so that's how that thing is called. No need to overcomplicate it, There is an easy if(){} else {} replacement for beginners.

Learing something new each day is what to takes to keep moving ahead in life. The OP propably doesnt need the overcomplicated peice of ?: ternary operator to solve his problem but having the knowledge that such a thing exists doesnt hurt either, does it ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It must be somthing in your source code which might be causing this problem.

Also mention the files which are present in your current project.

Did you mess with the settings of the directories and so on.

Post entire thing, and we will see what can be done.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

.X files are basically Microsoft format of 3d model files which are used in the game development industry for storing the 3D model information.

And as far as manipultaing them is concerned, you can use a 3d Modeling tool like Blender to make your own .X files and change existing ones.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes just follow Mr. Anonymusius's advice and keep some things in mind:

1. Avoid the use of global variables since its a bad programmign practice.

2. If you dont know pass by reference make the function return the updated total. That looks like a good programmign practice :)

3. Another operator which can be used for conditional checking is the ternary operator ?:

bool isEven = ((a % 2) == 0) ? true : false ;

Hope it helped, bye.

PS: 0 is an even number.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey Micko, your program properly compiles and gives the expected output. What problem are you facing ????

My output:

6.8, 11.2
Press ENTER to continue.

Hope it helped,bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I think you missed a hint of sarcasm in Lerner's reply. :)

Yeah kind of, these people dont even tell me when they are serious and when they are not. Sudden swings from serious thoughts about how to solve the equation to quoting sarcasm are a bit err... hard to determine.

Anyways like Mr. Rashakil Fol said, the problem stmt is simple or complicated depeding on the feat the original poster is trying to achieve. But assuming that its a college exercise, double root detection wont be necessary i think.

And btw good scarcasm Mr. Lerner, you almost got me there. :mrgreen:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What are u exactly trying to prove Mr. Lerner. First you say there is no straightforward way to do it and ask the OP to use an external library. And when the solution is posted you say that even a ten year old kid could do it ???

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The link below includes the configuration of newmat library in depth along with few examples.
http://www.unc.edu/courses/2004fall/psyc/285/001/NM10.htm#gcc

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

@Andor

Asssuming that the elements in the two dimensional array are contiguous doesnt necessarily hold true. For performace reasons, the data is aligned with the byte boundaries (which in the case of 32 bit computers is 4 bytes). So an optimizing compiler might leave in empty spaces or gaps between the elements of a single row to achieve.

Thus relying on a double pointer to be a two dimensional array is not always true (Like MR. Salem has already explained).

Something like teh below code will be much safer.

int func([B]short mat [][3][/B])
        {
        short    i, j, *index[3];

        for (i = 0; i < 3 ; i++)
                [B]index[i] = &mat [i][0] ;[/B]

        printf(" Declare as double-pointer, use auxiliary pointer array: ");
        for(i = 0 ; i < 3 ; i++)
                {
                printf("\n");
                for(j = 0 ; j < 3 ; j++)
                {
                    printf("%5.2d", index[i][j]);
                }
        }
        printf("\n");

        return 0;
}

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Protability can be ensured if you aim for the *nix platform since those open source and GNU supporters ensure that the app runs on each and every Operating system whereas Microsoft doesnt give a damn.

GTK is an opensource Graphic Toolkit and is completely portable, so if you use it, portability should not be an issue. If you have some money to spend then you can aim for the QT toolkit which provides the necessary GUI support and has very good support site with excellent video tuts, but of course it comes for a price. The decision rests in you.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just searching for the code to do something or to complete a project is no substitute for solving the problem by putting in your genuine effort. If you want to solve or make this project why not consider it as a fun exercise and try your own hand at it. If you still have problems, look at the code provided on some sites and try to learn from it. It you still have doubts regarding anything post your question here.

Just copy pasting the code and then completeing the project wont do you any good.

Salem commented: Another good comment - Salem +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

C++ can as such achieve any possible task you can think about. The only problem is the GUI support doenst come along with C++ so you would have to use GTK (graphic tool kit) to achieve the graphics related functionality. To help you out with some of the most common tasks you can also try out the boost library for C++ which has an easy interface for calling out those funcitons.

As far as Java is concerned, it has inbuilt GUI capabilities (Swing) and much better support for network related functionality. The only problem is the speed concern. Java tends to eat up more resources than an application developed in C++ (ok i dont want to start a language war but this is what i think). Officially quoted Java is 90% the speed of C++.

So in the end it depends on the kind of application you are required to make. Just analyze the problem considering all the constraints mentioned above and choose the one which suits you the most.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The first step in solving the problem is to identify the problem domain properly. Dig out some information on partial fraction decomposition, try to formulate a basic algorithm (the sequence of steps you would follow in achieving the objective).

To start off with, just post a basic algorithm on achieving the desired task and we will definately guide you through the rest of the process.

Maybe the below link will help you in formulating a basic algorithm,

http://www.mathematicshelpcentral.com/lecture_notes/precalculus_algebra_folder/partial_fraction_decomposition.htm

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey there, welcome to the community and be ready to join the fray (just joking). Hope you enjoy it here and get all the help that you wanted.

And yes I think Miss Dani started this forum under her own name (Dani Dani... yeah man i love saying it.)

Best of luck with your future endeavours.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It would really benefit to you if you could read on some introductory material to the C++ programming language or some newbie book like "Sams Teach yourself C++ in 21 days" to get the hang of the subject.

This forum will help you definately if you get stuck in your coding attempt anytime but before that you must know the basics of the language and must have dedicated some time and research on it.

Anyways, welcome to the coding hell.

PS: Long time no see Mr. Dave. Welcome back.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Some points to point out in your code:

1. int main (void) is the correct prototype for the main function and not void main.

2. Dont use #include <conio.h> which is console based I/O library, it kills program portability.

3. Dont use old style headers in C++. Use something like the #include <iostream> along with using namespace std ; to use the I/O functionality.

4. Dont use clrscr() to clear the screen since its a non standard function.

andor commented: You're right (by andor) +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Thanks for all the help I got a 97% on the project. :)

Congratulations, just keep on putting effort in your work and the rewards will definately come back to you. And if you encounter any other problem just dont hesitate to ask it.

Hope you are enjoying your stay at the community.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

No, you shouldn't make it global if you don't need it outside the function.

Yes. Simply define the counter as static int counter; instead.

Yes, it actually depends like you said on the type of feat you want to achieve. If you need to access the variable outside the function call you need to make it global.

So if the OP is just using the print value of the variable counter for debugging aid then he should go ahead by declaring the counter simply as static. But if he wants to use the value of those mouse clicks for some other purpose (like displaying at the end of the game how many mouse clicks performed) then he would have to adopt a different approach.

So in the end it actually depends on a lot more things and the problem stmt here, so either implementations are not wrong.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

hi!!!
this is pooja and i need some help desperately....
i have been told to submit my project in 15 days on airline reservation ..using graphics,filemanipulation,friend function,inheritance and all such features....
prob ic dat file manipulation is yet not taught and inheritance is still too new ..never d less i have tried to include all of this bt error always pops up....pls help....
the prog is....................

Hey pooja there are many things in your code worth pointing out to you.

1. Is integrating graphics really a part of your project, coz i think that the project if properly done would look goood whether its done in pure C++ or C++ using graphics.

2. If you are using C++ then why follow the old style of including headers in your program. Why use a non-standard header files like #include <conio.h> and #include <dos.h> .

3. Why not use the powerful object oriented features of C++ language and seperate the graphics from the functionality ? That way it would be better for you to maintain the code as well as for us in understanding your code.

4. Why not use the C++ standard functionality by including headers like #include <iostream> and #include <fstream> and then including the standard functions using using namespace std; .

5. Avoid using cryptic names for your classes and variables. Give them names which justfiy their purpose the most.

6. You really need to concentrate on the way …

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

In a statement like this
It appears that im trying to count the mouse clicks, but of course this wouldnt work. After the function call is done for void mousebuttonhandler counter is deleted.

I am brand spanking new to glut and i can't really think of away to accomplish counting mouse clicks. In java this would be simple, any help would be appreciated.

Why not try to make the variable persistent throughout the program by declaring it as global static variable ? Something along the lines given below by me would help you in solving your problem.

#include <stdio.h>

static int counter ;

int get_count () ;
void incr_count () ;

int main (void)
{
    printf ("\nThe counter initially is %d .", get_count ()) ;
    incr_count ( ) ;
    printf ("\nThe counter after first call is %d .", get_count ()) ;
    incr_count () ;
    printf ("\nThe counter after second call is %d .", get_count ()) ;

    getchar () ;
    return 0 ;
}

void incr_count ( )
{
    ++counter ;
    return ;
}

 int get_count ( )
{
    return counter ;
}

Just implement something like above in your code, making the necessary changes. It would run fine according to me. In case of any other doubts do post again.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sorry for my ignorance. As I am new to this blog, I was unaware of the rules.
I tried to edit the post as you suggested, but could not do so.
I will definitely take care of all the rules in my future posts.
I am extremely sorry if I hurt anybody by breaking the rules.
Thanks
Iqbal

As long as you learn from your mistakes, everyone is happy about it. And btw welcome to the forums. Just be kind enough to respect other ppl out here and i am sure you would get all the help you require.

Keep rocking....

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
#include <mysql.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
#include <stdlib.h>


void error(char *msg)
{
    perror(msg);
    exit(0);
}


int main(int argc, char *argv[]) 
{


   MYSQL *conn;
   MYSQL_RES *res;
   MYSQL_ROW row;

   char *host = "192.168.2.11";
   char *user = "daily1a";
   char *password = "daily2006";
   char *database = "28882db";

   char string1[500], query[500], Tid[50];

   void senddata(char *SendString);

   conn = mysql_init(NULL);

      
   /* Connect to database */
   if (!mysql_real_connect(conn, host,
         user, password, database, 0, NULL, 0)) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(0);
   }

   /* send SQL query */
   if (mysql_query(conn, "SELECT MobileNumber, StartDate, EndDate FROM Subscriptions where Status=0")) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(0);
   }

   res = mysql_use_result(conn);
   
   /* output fields 0, 1 and 2 of each row */
   while ((row = mysql_fetch_row(res)) != NULL)
   {
      bzero(string1, sizeof(string1));
      sprintf(string1,"%s,%s,%s", row[0], row[1], row[2]);
      printf ("%s\n",string1);
      senddata(string1);
   } 

    [I][B]if (row[9]==0)[/B][/I]
    {
        bzero(query, sizeof(query)); 

            // [I][B]Tid = atoi(row[0]); 
     
[/B][/I]         sprintf(query, "UPDATE Subscriptions SET Status = 1 WHERE MobileNumber = '%s'",Tid); 
    }      

   /* Release memory used to store results and close connection */
   mysql_free_result(res);
   mysql_close(conn);

   return 0;
}

void senddata(char *SendString)
{

  char buf[8192];
  char message[256];
  int socket_descriptor;
  struct sockaddr_in pin;
  struct hostent *server_host_name;

  char * host_name = "127.0.0.1";
  int port = 8000;
  char * str = "A default test string";

  str = SendString;

  if ((server_host_name = gethostbyname(host_name)) == 0) {
  perror("Error resolving local host\n");
  exit(1);
  }

  bzero(&pin, sizeof(pin));
  pin.sin_family = AF_INET;
  pin.sin_addr.s_addr = htonl(INADDR_ANY);
  pin.sin_addr.s_addr = ((struct in_addr *)(server_host_name->h_addr))->s_addr;
  pin.sin_port = htons(port);
 
  if ((socket_descriptor = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
   perror("Error opening socket\n");
   exit(1); …