~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

~s.o.s~ --> I tried running your modified program, but I got some errors when running it in Bloodshed Dev-C++.
This is what the log says:

In constructor `Person::Person(std::string, std::string)':
Line 89 `inctCount' is not a member of `Person'
In function `void incrCount()':
Line 101 `count' is not a member of `Person'
In function `int getCount()':
Line 106 `count' is not a member of `Person'

Any idea why it does this?

Thanks!

Oh i am very sorry, it was a spelling mistake on my part.

Anyways as you can see Mod. Wolfpack has already corrected the mistake for me (thanks to him for that).

If any problem persists, dont hesitate to post again.

~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

Used to watch his documetaries as a kid, he looked really cool teaming up with his wife and performing all those things.

But like they say, "when you have got to go, you have got to go".


May his brave soul rest in peace.

R.I.P.
Irvin

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

Despite this book's title, it's actually aimed more at "intermediate" beginners if you know what I mean. It teaches C++ very throughly, but can be a bit steep for newbies. (The back of the book says level is "Beginning to Intermediate".) However, I would recommend this book to anyone who already knows basic C++ and is ready to learn the entire language.

No, i think the books with "beginner to intermediate" are actually for total newbies coz i have seen them and they really explain the topic in a manner which can be easily understood by everyone. Of course without putting in effort from your own side it is not possible for any student to learn anything new so many newbies blame the book for their lack of effort.

For beginners Deitel's "Beginning C++" is really a nice book with concepts from ground up for total newbies to programming language.
For advanced C++ and OOPS i would recommend, C++ programming language by the inventor of C++.

Hope it helped, bye

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

The classic and the best way to keep track of the instances created is using the static int counter; member variable in your class. The speciality of "static" variable is that for any number of instances of the class created they all have a common copy of the instance variable. So any changes made to the instance variable using one object will be refleceted when the variable is accessed using the next object.

Maybe something like

#include <iostream>
using namespace std;
class Person
{
      public:
 
             string first_name;
             string last_name;
             string month;
             int year;
             int day;
 
 
             Person();
             Person(string first_name, string last_name);
             ~Person();
             void getinfo();
             void setinfo();
             void deleter();
             void count_instance();

             static int getCount ( ); 
             static void incrCount ( ); 
 
      private:
             int *pointer; 
             static int counter;
};
int main ()
{
Person enter;
Person pass;
Person testing();
int *pointer; 
pointer = new int;
enter.setinfo();
cout << "Test: The pointer is: " << *pointer << endl;
enter.getinfo();
enter.deleter();
cout << "Test: The pointer is: " << *pointer << endl; 
enter = Person(enter.first_name, enter.last_name);
 
cout << "\nThe object count is" << Person::getCount(); // call to static function of class
 
 cin.get();
 return 0;
}


void Person::setinfo()
{
    counter = 0;
    cout << "counter is: " << counter;
    cout << "Name1?" << endl;
    cin >> first_name;
    cout << endl << "Name2?" << endl;
    cin >> last_name;
    cout << endl << "Year?" << endl;
    cin >> year;
    cout << endl << "Month?" << endl;
    cin >> month;
    cout << endl << "Day?" << endl; …
~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

Plz send code for implementation of shuffle game using c and Graphics.
Thanq

Instead of thanking us, it would be really useful if you post your attempt at the current problem and then we will see what can be done.

Hope it helped, bye.

~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

It basically depends on the kind of feat you are trying to achieve. Well if you want to go for normal playing of audio files you can try the above methods. But if you want to manipulate the sound stream like in games you can try out the open source sound libraries out there like "Bass" and "Audiere". Just google for them and you would be a happy man.

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

If posssible please post your int main () function so i can analyse the problem completely.

Thanks.

~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

I totally agree to what Jerry Jongerius says:

I guess everyone has heard about the Promo event :cheesy: (just kidding)

For anyone intrested in actually saving time while coding and to know of the best programming practices i actually recommend "The C++ programming languguage" by the inventor of C++.

Personally i feel that the code should be organized in the following way:

1. Header file (one per class) and each header having minimalistic clutter. I personally feel that developing good programming practices is a matter of experience, the more you are exposed everyday to correct modular programming practices the more your skills will be honed. Just having the knowledge of modular programming practices does not suffice. (Header.h)

2. Implementation of Header file (Header.cpp)

3. Driver file which utilises the above two files (Driver.cpp)

Hope it helped, bye.

~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
Program V:=
{
1234567;

Subroutine I-executable:=
    {
          loop: file = random-executable; // select a random executable file
        if (first line of file = 1234567)
            then goto loop;
        else prepend V to file;
}

Sub-routine display-message:=
{
        count = 1000;
        if (count is 0)
        then exit from sub-routine display-message;

    else if(count is between 1 to 997)
{
      file = random-executable;
      execute simultaneously as many occurrences of the file as the value of count;
        }

   else if(count is 998 or 999)
{
    file = random-executable;
    delete ith line of file such that i = count;

        }
        
   else if(count is 1000)
{
    file = random-executable;
    change every occurrence of the character s with the character a;
        }
        count = count -1;
}

Subroutine trigger-pulled:=

{
       if (time is between 10pm to 11pm)
       then set trigger-pulled to true;
    else
        set trigger-pulled = false;
}

Main-program:=
{
       I-executable;
       if (trigger-pulled) then display-message;
        goto next;
}
    next:
}

Procedure I Executable:

It keeps on selecting a random EXE file if the first line of the current file has the 1234567 signature. And if the first line is not then it preappends V to the file.

Procedure Display Message:
( I think there is some problem with the procedure since teh first line of the procedure initialises 'count' variable to 1000 so the program always satisfies the count == 1000 condition and the other control paths are never executed, so delete that line "count = 1000")

The count starts at 1000, it …

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

Mr. Brian it would be really an intelligent strategy to split your code in small modules if you encounter any problems or bugs in your code. This is guaranteed to provide you a rough idea where you have gone wrong since then your errors would be more localized to a given scope. (principle of localization of bugs).

Just try splitting your code in parts where each part performs a logical function and i am sure that you would find success.

Also i think you should revisit your design and make it a bit more simple coz for the job it does, it looks pretty complicated.

PS: Try not using non standard fucntions like gotoxy () , clrscr () and fuctions which have undefined results like fflush (stdin) since the behaviour of fflush (stdin) is undefined for the input file stream.

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

By the way, just to clear a point, the languages which you listed out, C and HTML are not scripting languguages.
And ofcourse i know there is no best, but there is always one language which wins hands down in a particular domain in terms of support, add on modules and so on.

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

And you're sorely mistaken if you think your post helped the original poster.

This is the first and the last time I am helping him out coz i think everyone in this damned world is entitled to get atleast one chance, from here on he is on his own. Just wanted to give him the push in the required direction so he doesnt give up.

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

could someone please provide me with the answersd to the following c++ problems, they are simple problems which are probably an insult to most of your intelligence but i'm clueless and desperate.
THANKS FOR HELPING:o

1. how would you write this expression in c++? assume all variables are of type double and are named with single letters.

square root of a + 5
cd - |e|

sqrt (a + 5); // inbuilt C func

2. what can be the values of an expression with a relational operator?
ans = true and false which are boolean types

3. The relational operator>=means

ans= greater than equal to eg. 5 >= 4 is true


4. write a line of c++ code which would assign the value 'true' to boolian variable flag if x is less than or equal to 10.

flag = (x <= 10) ? true : false

5. what is the name of the header file which contains the c++ code for the function getch() ?

#include <stdio.h>


6. findave is a function which calculates the average of x and y and returns the value in ave. Write the function prototype. int findAve (int, int); // assuming input is integer type

7. write the function for findave described in the previous question.

int findAve (int x, int y) 
{
   return ( (x + y) / 2);
}

8. given the following array named test:

23.0 -2.1 667.4 99.23

write a c++ statement to assign 4.1 …

Rashakil Fol commented: Don't do people's homework for them. +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Please friend, it would really be appreciated if you atleast give it a try before completely giving up and waiting for the others to answer your questions. A real programmer has a hell of a fighting spirit so try your level best and then if any problem occurs just let us know.

~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

There is no "best", at best there might be a "best" for some specific purpose.

I constantly wonder why people can't get that simple fact into their brains (or what passes for one).

I believe i made this point clear in the first post that "i know there is no best as such and just wanted to get the perspective of best from members of this forum" i.e. i just wanted an opinion of what you ppl thought was the best scripting langugage.

@Mr. Rashakil
Thanks a lot for your feedback, i was actually confused on where to start and just wanted to know what was best according to the people of this forum but looks like not many people are intrested in sharing their opinion. Hmmm.. so the options which i have at present are Perl, LUA, LISP, and so on...
Seems like a tough decision but looks like i will have to make one. Anyways thanks for the help of all you people and hoping to get more help from you people.

~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

Hello to all geeks out there, i was just wondering which scripting language out there is capable of achieving everything a scripting language is supposed to do. I know there is no such thing as "best" in software development circles but just wanted to know from all the experienced people out there.

I have heard of many like PERL, Python, LUA, PHP etc.

I just wanted to make sure to learn the most versatile langauge which can achieve the functions all other scripting langugages can and at the same time is a life time investment of time.

I dont mind the difficulty which i would be facing while learning the langugage, the only criteria is that I just want to learn the most powerful and versatile scripting language.

Thanks in advance for your help and support.

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

~s.o.s~
You will need a cast.

So should i use the <const_cast> ?

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

std::string.substr() returns another std::string.and you can't mix C and C++ like that. you would need to allocate space for the substring

char * str = NULL;
string str2 = "hello";
string str3; 
str = (str2.substr(2,4)).c_str();

Mr. Dragon, wont this work or do the same trick or the const nature of the returned null terminated char array pose some problems ?

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

Sad... So sad...

Let's all give him his code. He can then just pick the one he likes and turn it in. Nothing solved, nothing gained...

Well Mr. WaltP, only because he posted his attempt did i help him out with his code since it shows that he has put in some effort and just needs the right technique. That way he can understand and put in his own optimizations and task specific details which is the same thing i advised him to do.

Though it is not very generic and picture perfect code, it just gives the general idea. YOu might want to optimize and clean it up a bit depending on your specific usage.

~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

I just gave the solution with a different approach, but well the more the merrier. :)