~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); …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
#include "stdafx.h"
#include <iostream>
using namespace std;
int a=10;
[B] void[/B] main()
{
 a=20;
 cout<<a<<endl;
 cout<<::a<<endl;
}

BTW just as a reminder, main (void) doesnt return void , it returns an int which is the signal to the operating system about the execution status of the program. A zero is returned on flawless execution while a non-zero return implies there was some problem faced while executing the code.

Hope it helped, bye.

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

Conceptually and logically you can convert a code written in any language into a code of any other language, obviously there are some exceptions.

And as far as my knowledge is concerned, i dont think there is any software which directly as such converts code written in Java to a code of Borland C++. And btw Borland C++ is as such not a language but an IDE. The language is C++.

Why not just write a code from scratch on your own ? One more question, is it absolutely necessary for you to use a non standard graphics library. If you are intrested why not just try out OpenGL ?

Hope it helped, bye.

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

Yes what Mr. Hollystyles said is right.

Btw i hope you dont mean to ask something like:

int* a = NULL ;
int* b = NULL ;

// some operation and allocating memory to ptrs.

// a and b point to the same mem. location 
// address in "a" overwritten by address in "b" 
a = b ;    


// a and b point to the same mem. location 
// address in "b" overwritten by address in "a" 
 b = a ;

Hope it helped, bye.

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

Yes maybe something along the lines what Mr. GloriousEremite has given should solve your problem.

int main (void)
{

    ifstream in_file ;
   
     // start of naked block according to the principle of least
     // data exposure.
    {
        string file_name ;
        cout << "Enter the name of the file: " ;
        cin >> file_name ;
        in_file.open ( file_name.c_str ( ) ) ;
     }

    if ( in_file ) {
        cout << "\nOpening of file was successful " ;
    }
    else {
        cerr << "\nFailed to open the file " ;
        return ;
    }

    cin.get () ;
    return 0 ;
}

HOpe it helped, bye.

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

Sorry if i sounded rude, that wasn't intentional.

By my post what i wanted to convey was that since a library is released by a orgaization or an individual the manpages or the manual of the library is most likely to be provided by the same people and it is highly improbable you would find an alternative documentation.

So the only alternative you are left with is to understand the given documentation which i am sure you would be able to in the near future.

Best of luck with your project.

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

forgive my overstatement .. i'm actually planning to build a function and not the whole library

if you're familiar with quantlib maybe u can point me to a more indepth treatment of the functions, because for the one that i've found,
http://quantlib.org/reference/newton_8hpp.html

it is not helping.

Hey let me ask you few questions first:

  • How much do you know C++ ?
  • Do you know what a namespace in C++ and how it works ?
  • Have you in your academics done or encountered the terms or concepts which have been implemented in the library and the ones you are trying to use ?
  • What is the maximum complexity of the C++ program you have written till date ?

Well you see the thing is that you should always start small before jumping in the fray. Try to understand small small things and concepts before going overboard with the big ones.

And just a food for thought, how do you propose we make you understand the library even if we knew it ? Obvioulsy it is you who must understand the library and so it is you who must put in all the required effort. Even i had used external library many times (Irrlicht game library, Audiere Sound library) and i know it takes many days to master the function calls and understand the whole architechture.

Hope it helped, bye.

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

Wow, now thats the kind of spirit we expect from a programmer.

But if you dont undestand the documentation which is specifically tailored for the people who plan on using it and those who know the basics of the language, do you think you can handle a big thing like library development all by yourself.

Better do a reality check if you really want to move ahead in life. Start with small goals and then eventually you will reach the destination which you always desired.

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

hahaha funny asshole

Hey that is very uncalled for and for your kind information Mr. Ancient Dragon is a senoir member of this forum. Take back your stmt and apologize this instant.

[edit]
Oh it looks like Mr. Dragon is comfortable with this so its also ok with me.
[/edit]

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

Understanding you problem domain in the first step in solving a problem. If the above assignment would have been in Java it would have been simple matter of using Applet to draw the lines and circles but as it is in C you need to use an external library to draw the circles and other figures.

Search the net for the logic for drawing the above figures and tackle the problem in small chunks. Come up with a rough plan and try the flowchart and algorithm approach.

I would have given you the code but that would have made the other members here angry ( i already have got a bad post trying to help out a newbie) and also it would do you more harm than good (seriously).

If you feel you lack the required C knowledge consider falling back to the basics and coming back to the project after you have done your studies.

HOpe it helped, bye.

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

Yes you better follow the guidelines laid down by Wolfpack to solve your problem but while finalizing your code just replace the scanf with either getchar () for gettign a character or fgets ( ) while getting a string.

scanf is a prettly complex function and leaves the input stream dirty with the junk.

Hope it helped, bye.

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

Instead of using Libraray which draws out jagged circles and which are non standard, better start using OpenGL since it has the same learning curve as that of your BGI (atleast for the basic things) and is much more useful and much more fun.

For eg. if you have to draw out a circle using the circle equation, you could use something like this:

while (some_control_loop) {
  // calculate the values of x and y using the std eqs.
  
glBegin(GL_LINES);


// All lines lie in the xy plane.
z = 0.0f;
for(angle = 0.0f; angle <= GL_PI; angle += (GL_PI/20.0f))
  {
  // Top half of the circle
  x = 50.0f*sin(angle);
  y = 50.0f*cos(angle);
  glVertex3f(x, y, z);    // First endpoint of line

  // Bottom half of the circle
  x = 50.0f*sin(angle + GL_PI);
  y = 50.0f*cos(angle + GL_PI);
  glVertex3f(x, y, z);    // Second endpoint of line
  }

// Done drawing points
glEnd();

Well this is a simple eg which shows how u can draw a circle.
Hope it helped, bye.

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

The best way to start learning a library is reading its documentation properly and visiting the related forums. If you still feel that you are lost then you need to do a check whether you really prepared to handle this project.

Hope it helped, bye.

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

Segmentation error means runtime error which you get when you access the memory location which doesnt belong to you.
A typical case where this kind of error occurs is during array accessing which is known as buffer overflow.
Are there any array accesses in your code and if yes then check whether you are accessing the element which belongs to you.

For eg.

int my_array [4] = {1, 2, 3, 4} ;
// my_array [0] is the first element and my_array [3] is the last element.
my_array [4] = 20 ; // buffer overflow, runtime error

Hope it helped, bye.

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

please
answer the code for string to double and string to long in c
bye

To perform these tasks there are in built functions in C namely. atol (yourString) : string to long atof (yourString) : string to double

And asking directly for a code is not the way to success. First post your attempt and we would be definately there to help you out.

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

thank you andor..
1 new question i want to ask.
can java applet window can convert to borland c++?

I dont think i get your question. Please explain it in detail.
Java applets are coded in Java while C++ is a different story altogether.

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

Hey this problem is too simple to implemented in an objecft oriented way. Programs this small do not need to have good programming practices. Especially if teyt are just for fun. For somthing this small it only matters if it works IMO. Yes is you are coding some massive trading system for a bank then ofc i should do that.

Looks like you have never undertaken a large project at hand otherwise you wouldnt be saying such a thing. Learning things the hard way should not be at the top of your list :)

In the end, just remember one thing "Old habits die hard".

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

Please post your own effort and then we will see what can be done to help you out. Just asking for a source code file would do you no good and beats the purpose of doing engineering.

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

Post your attempt and we will definately help you out on topics on where you got stuck. Just giving out the source code would do you more harm than good.

Salem commented: I agree - Salem +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hey Becki,

Im not that good a coder and this program is unweildy and long but you could implement it like this:

#include <iostream>
using namespace std;

// not a good programming practice to declare global variables.
// this beats the intended use of the best object oriented language 
// around (C++). Following the principle of information hiding is best
// implemented when each logical unit has its own memory and hides
// its own implementation from the other units.

// Your program does not comply with this.

int decimal=0;
int input[10];
int i =0;
int j;
int k=0;
int a=0;
int power = 1;

int convert(void)
{

i -= 1;

    while(a<=i)
    {
        decimal = decimal + (input[a]*power);
a++;
        power = power*2;
    }
    
    return decimal;

}

int main(void)
{

     cout<<"Input binary value, pressing enter after every value, type '2' to finish"<<endl;
     
     while(j != 2)
     {
         if(k>0){input[i] = j;
                 i++;   }
      cin>>j;
      
      k =1;
     }

cout<<convert()<<endl;
     
// never use os dependent function calls and btw this call has a very 
// high overhead. Better use cin.get () in case of C++.

      system("pause"); 
return 0;

}

Good programming practices and better understanding of the problem domain is the key to becoming the best programmer around.

Hope it helped, bye.

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

The algorithm for cleaning out duplicates from a dynamic array has the following procedure:

1) Store the current record in the variable.
2) Using a compare function, compare the current variable with each and every variable of the dynamic array storing the records.
3) Whenever a match is found, delete that record (if your dynamic array is implemented using linked lists then you can use the concept of linked list deletion).
4) Keep continuining till more records are found.

Hope it helped, bye.

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

1. I'm making a program with a default constructor and an overloaded constructor. They're both called by different rules and produces a testline of text when called. The assignment is to give the overloaded constructor default arguments to see what happens. I wonder, what is a default argument i an overloaded constructor?

ans: i am sorry but i dont understand what are u trying to convey here. Post the same question with some examples on how you are going to implement it.

2. How do you instance an object from a class in different scope?

ans: Just create the object a normal way but just keep in mind that that instance of the object will only be valid for that same scope and not beyond it.

3. How do you send an object "by value" to a function?

ans: Objects and variables are by default sent by value. To send the object by reference you can do pass by reference using the C++ reference mechanism or the old C style pointer mechanism.

4. How do you make a function which swaps the values of two indexes on a vector (like swaps numbers[1] with numbers[2])?

ans: The ans to this lies in the prev question. To make function reflect teh changes done to the variables beyond the function scope you need to pass the variable using the pass by reference mechanism.

I would very much recommend you to get all your objected …

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

For absolute beginners, i would recommend "C++ in 21 days" and if you want to move ahead from the beginner stuff i would recommend "C++ programming language".

Hope it helped, bye.

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

O-notation

The Θ-notation asymptotically bounds a function from above and below. When we have only an asymptotic upper bound, we use O-notation. For a given function g(n), we denote by O(g(n)) (pronounced "big-oh of g of n" or sometimes just "oh of g of n") the set of functions

O(g(n)) = {f(n): there exist positive constants c and n0 such that
0 ≤ f(n) ≤ cg(n) for all n ≥ n0}.

We use O-notation to give an upper bound on a function, to within a constant factor. This is the formal defination and of course what Mr. Salem has said applies as well.

Hope it helped, bye.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
#include<iostream>
using namespace std;

void Compare(int[],int[],bool [],int);
void acceptInput (int [], int []);
void displayResult (bool []);

int main()
{
    const int arraySize = 5;
    int CorrectArray[arraySize];
    int PupilArray[arraySize];
    bool ResultArray[arraySize] = {false};
    acceptInput (CorrectArray, PupilArray);
    Compare(CorrectArray,PupilArray, ResultArray, arraySize);
    displayResult (ResultArray);
    return 0;
}

void Compare(int correct[],int pupil[],bool Result[],int size)
{
    
    for ( int i = 0; i < size; i++ )
        if ( correct[i]== pupil[i] ){
                Result[i]=true;
            }
  
}

void acceptInput (int CorrectArray[], int PupilArray[])
{
    cout<<"Enter the memorandum : ";
    for(int i = 0;i<arraySize; i++)
    {
        cin>>CorrectArray[i];
    }
    cout<<endl;
    cout<<"Pupil's answers : ";
    for(int j = 0; j<arraySize; j++)
    {
        cin>>PupilArray[j];
    }
}

void displayResult (bool ResultArray[])
{ 
  for (int i = 0; i < arraySize; ++i)
  {
     if (ResultArray [i] == true)
     { 
        cout <<"\nThe answer " << i + 1 << "is correct.";
     }
     else
     {
        cout <<"\nThe answer " << i + 1 << "is incorrect.";
     }
  }
}

Or in a more fuction oriented way.

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

Can anyone figure out why I get -9.032654e something from my biWeeklySalary function?

#ifndef EMPLOYEE_H
#define EMPLOYEE_H

#include "HireDate.h"

#include <string>
using std::string;

class Employee
{
public:
    Employee();
    Employee( const string &, const string &, const string &, const HireDate & );
    ~Employee();

    void setFirstName( const string & );
    string getFirstName() const; 

    void setLastName( const string & );
    string getLastName() const;

    void setSocialSecurityNumber( const string & );
    string getSocialSecurityNumber() const;

    void print() const;

private:
    string firstName;
    string lastName;
    string socialSecurityNumber;
    const HireDate hireDate;
};

#endif
#include <iostream>
using std::cout;
using std::endl;

#include "Employee.h"
#include "HireDate.h"
#include "MailCarrier.h"

//constructor
Employee::Employee()
{

}

//Constructor 
Employee::Employee(const string &first, const string &last, const string &ssn, const HireDate &dateOfHire )
    : firstName( first ), lastName( last ), socialSecurityNumber( ssn ), hireDate( dateOfHire )
{

}

Employee::~Employee()       //destructor
{

}

//function to set Employee's first name
void Employee::setFirstName( const string &first )
{
    firstName = first;
}

//function to get Employee's first name
string Employee::getFirstName() const
{
    return firstName;
}

//function to set Employee's last name
void Employee::setLastName( const string &last )
{
    lastName = last;
}

//function to get Employee's last name
string Employee::getLastName() const
{
    return lastName;
}

// function to set Employee's Social Security Number
void Employee::setSocialSecurityNumber( const string &ssn )
{
    socialSecurityNumber = ssn;
}

//function to get Employee's Social Security Number
string Employee::getSocialSecurityNumber() const
{
    return socialSecurityNumber;
}

//function to print Employee object
void Employee::print() const
{
    cout << "Employee: " << getFirstName() << ' ' << getLastName()
        << "\nSocial Security …
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Looks like no one is intrested in posting their resources or the things which they know, but still i would continue helping other people out.

Here are some more links which are related to graphics programming using OpenGL.

Intro Opengl and C
http://www.eecs.tulane.edu/www/Terry/OpenGL/Introduction.html

THe all famous Nehe tuts for beginners
nehe.gamedev.net/

OpenGl advanced samples
http://www.xmission.com/~nate/tutors.html

Excellent site must see for all
http://www.lighthouse3d.com/opengl/index.shtml

Grunt commented: Keep Up The Good Work-[Grunt] +1
infopawar commented: i like it very well +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I think when you start off you are at an unknown quantity that is 0 rep points. Each green bar amounts to 50 rep points. So once you gain those you transit from "unknown quantity" to "distiguished road". And the same goes on for multiples of 50, every time with a new rep title.

Hope it helped, bye.

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

Listen, I don't speak c++, I don't really care what you c++ rabis debate about evry day.
In school we do Pascal , Pointers don't come into play until 1st year university.
Thanks for the advice anyways,
Ishwar

Frankly one sentence, PLEASE APOLOGIZE THIS INSTANT.
It really hurts when someone goes to the length of wasting his precious time and effort to help a newbie get his path right and all they get is this. Just put urself in our shoes and you would know what i am talking about. I wont adopt the aggressive attitude of Mr. Wolfpack and Mr. Salem and say sarcastic things coz i dont think i have the knowledge set they possess.

Even if you didnt like the anwer or have that PASCAL thing in your head, you could have atleast pretended that the answer helped you than throwing out things like "i really dont care". One thing you should keep in mind that no one in this forum is bonded to this forum in any agreement and formal sort of way. Its just a voluntary service all the people here provide so that newcomers dont have to go through all that these experts had to go through and show a path of correct and precise thinking.

Just think about it and you would know what you may have wanted to said and what you actually ended up saying.

Grunt commented: Nicely Said [Grunt] +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It is quite simple: every other language you will see in this thread has a set of features that is a subset of the features of Common Lisp. I recommend learning Lisp for a few reasons:

1. It's the most powerful and versatile language*. (Or maybe some other variant of Lisp is; this is just standardized and the most popular.)
2. If you learn Lisp, you'll never have trouble learning another language.
3. Your ability to think about programming will improve, too.

Don't balk when you see the parentheses. I can assure you they're not a problem :-)

*O'Camlers, Haskellers, and Prologers may feel free to disagree.

The reason i didnt mention LISP in my list of languages is that the resoureces present for LISP like ebooks and tutorials are very sparse on the net so i was wondering if i would ever be able to learn it.
Like there is CPAN for PERL nad PEAR for PHP no such thing for LISP i think ?

But what you say has really surprised me ! I thought any one of the four i have mentioned would have topped the list of Scripting languages. And btw by scripting language i mean something which can be used for linking modules, lightweight tasks, automating tasks and of thel likes (i dont mind if its more powerful :) )

Still waiting for your feedback, thanks.

PS: I thought you were a Python proponent ;)

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

Err.. buddy , it would be best you not resurrected dead threads. It would be really good if you just looked at the date of the last reply of a thread before posting in it. And by the way, the thread has been marked solved so please dont post in such threads.

Salem commented: Well said - Salem +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe something like

#include <iostream>
using namespace std;
class hello
{
private:
    char array[4][5];
public:
    hello();
    void get_hello()
    {
        cout << "From the function: array[2][2] = " << "'" << array[2][2]  << "'" << endl;
    }
} hi;

hello::hello()
{
    for (int i = 0; i < 4; ++i)
    {
        strcpy ( (array[i] ), "####");
    }
        cout << "From the constructor: array[2][2] = " << array[2][2] << endl;
        (*this).get_hello();
}

int main()
{
    hi.get_hello();
    cout << "\n" << "Press Enter to end this programm";
    cin.get();
    cout << endl;
    return 0;
}

Hope it helped, bye.

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

Rewrite your program in this way :

#include <iostream>
using namespace std;

int main (int argc, char *argv[])
{ 
   char quit = '\0';
   while (quit != 'q')
   {
       cout << "Hello ! This is a console app." << endl;
       cout << "To create a console, go to Project Options and select"     << endl;
       cout << "\'Win32 Console\'." << endl;
       cout << "Press q to quit " << endl;
       cin >> quit;
        }
    getchar ();
    return 0;
}

Copy and paste this code and tell the errors which result.
Hope it helped, bye.

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

Compiler list and starting resources.

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

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

Yes what Mr. Salem has said is perfect and if you want a more detailed account then you can try here.

http://msdn2.microsoft.com/en-us/library/bkbs2cds.aspx

Hope it helped, bye.

Grunt commented: Helps +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

the function
void fun()
{
char c;
if(c=getchar())!='\n')
fun();
printf("%c",c);
}
Gives the output cba .Can't say why?

This must have happened when you must have given the input "abc" isnt it ?

The above function is basically an example of a recursive function or basically a function which calls itself. Hence the above prog waits for the user input and keeps on accepting it until the user presses a Return or Enter key on the keyboard. And when the return key is pressed the entered input is printed in reverse order.

One note though, recursive functions if used improperly can cause stack overflow since each time a recursive function is called a new stack is allocated for the function.

Maybe this will give some info about the recursive functions
http://www.dsi.unive.it/~arch/corsoC/subsection3_9_5.html

Hope it helped, bye.

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

Structures are just like normal variables hence can be passed to the functions in the same way normal variables. The difference between structures and normal variables is that structures are User defined data types.

Consider for example the function which accepts a pointer to a variable and manipulates it.

void changeInt (int *ptrToVaribleBeingModified)
{
   *ptrToVaribleBeingModified = 10;
}

And the same can be done when we pass a reference to structure in the function

void changeStructure (MyStructure *ptrToVaribleBeingModified)
{
   ptrToVaribleBeingModified->value = 10;
}
// here MyStructure structure has only one field namely int value

And in main we have

int main (void)
{
  int i = 0;
  MyStructure structInstance;

  changeInt (&i);  // now i becomes 10

  changeStructure (&structInstance); // value field becomes 10

  getchar ();
  return 0;

Hope it helped.
Bye.

Grunt commented: [Grunt] +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Err.. isnt this what normally happens?

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

Err.. hello though i am not new to this forum, i thought since i had originally not introduced myself thought this was the time for doing it:lol:

BTW I am a student from India, who likes getting involved in technical discussions, helping other people out etc. etc. Hope I do keep up the good thing with your support and love.

Regards,
~s.o.s~

joshSCH commented: hehe.. Welcome! :) +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Software development nowadays is all about correct and efficient practices which makes the life of programmer easier for him to code as well as to maintain the code. Todays software development is more about effiecient Object Oriented Practices and following the UML standards to deliver quality and bug free software.

C was originally intended for developing Operating systems and its main asset was its speed considering the amout of memory old computers had. Today seeing the fast drop in dollar / MB of memory its more expected from a language to make the coding and maintenance easier for the programmer ie the language that has solid OO features.

All the above talk was to clear the point that it all depends on the subject matter under consideration. You would next talk about implementing or writing Assembly front end in Machine code and go out to tell that Assembly is the subset of Machine Code. This though is true it also implies that Machine code is the superset of each and every language present today.

I dont think the original poster wanted a C v/s C++ battle for pointing out to him that C++ front end can be easily implemented in C but rather which language is better for developing applications and which language the software community nowadays goes with.

But seeing from ur profile that u are an Assembly programmer, ur love for C is well understood but the point here is that it all depends …

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

Avoid using non standard headers and non standard functions since it is regarded as bad programming practice.

Avoid including #include <conio.h> since it is non standard header and destroys the portability of the program.

Same goes with functions clrscr () and getch () .

Instead of getch () use getchar () which is a std function.

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

Your program basically uses Bubble Sort to sort the array entries in descending order. Bubble sort uses 2 for loops to sort the array provided to it. The while loop in main serves as a replacement to the second for loop of Bubble sort. And it is the variable flag which decides till wat time the sorting should continue. When the array is completely sorted the control in the funtion never satisfies the condition if(block[j] < block[j+1]) . Hence the flag remains 1 and the sorting is complete.

In short

if (flag == -1) => array is not sorted and keep sorting
if (flag == 1) => array is sorted and now stop.

HOpe it helped.
Bye.

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

Welcome again to DaniWeb.

Just keep going on, never give up and we would be always there by ur side.

regards,
~s.o.s~

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