kunal kislay 0 Light Poster
main()
{
   double **vals = NULL; 
   function(vals);
}

prototype :

//some other dll
void function(const double**);

it gives me error : cannot convert double ** to const double **.

and yes i dont want to put extra burden on the user side(in main function) to const cast the vals as it is not his responsibility..

kunal kislay 0 Light Poster

it will exit if you enter N ..
ok previous code had some prob with std i/o

here is new one

# include <stdio.h>


int main()
{
	char choice;
	int emp_id;
    
	printf ("Enter employee Detail :  \n");
    do
    {
          printf ("please enter employee number: ");
          scanf ("%d",&emp_id);
          printf("Do you want to enter more employees? (Y/N) :");
		  while(getchar() != '\n') continue;
		  scanf ("%c",&choice);
          
    }while ( choice != 'N');
	system("pause");
    return 0;
}
kunal kislay 0 Light Poster

k do it like

# include <stdio.h>
# include <stdlib.h>

int main()
{
	char choice;
	int emp_id;
    
	printf ("Enter employee Detail :  ");
                do
                {
                              printf ("please enter employee number: ");
	              scanf ("%d", &emp_id);
                              printf("\nDo you want to enter more employees? (Y/N) :");
                              scanf("%c",&choice);
                }while ( choice != 'N');
	system("pause");
                return 0;
}
kunal kislay 0 Light Poster

i cant understand what you r actually trying to do..
can you post your whole code here?

kunal kislay 0 Light Poster

char choice, y, Y, n, N;
//no need of declaring y,Y,n,N they r useless
while (choice != N && choice == Y)

didnt see this

here it should have been
while (choice != 'N' && choice == 'Y')
comparision should be done with characters

kunal kislay 0 Light Poster

Hi
have done the whole program but now am stuck at what initially seemed like a simple thing a repitation loop
the program is supposed to ask the user if he/ she wants to continue with adding more data - if no exit and continue with the other stuff.

char choice, y, Y, n,  N;

while (choice != N && choice = Y)
{code 
code
code
)

now it keeps coming up with 3 different errors
1 it either just crashes
2 it just keeps doing the stuff of the while loop
3 it keeps telling me choice hasnt been initalized

I have just put in the bits thats causing a problem the rest of the program is fine

you need to take choice from user
like scanf("%c",&choice); for the first time then again in the whicle loop..

secondly

while (choice != N && choice = Y) here choice = y is wrong it should be choice == Y

kunal kislay 0 Light Poster

use rand() function to generate the the index of the Srting array and get that string..

kunal kislay 0 Light Poster

log file is for the sake of ur convinence ..
it helps u figure out where actually u r doing wrong..
one cant waste his/her time investigetting the whole code in case the program is tooo large to figure out his mistake.
looking at the log file it is easy to find out ur errors if the log file is correctly and smartly constructed.

kunal kislay 0 Light Poster

didnt see you logic but i guess here is the problem

while(i!='\0')
while(j!='\0')

it should have been str and atr[j] insteed

kunal kislay 0 Light Poster

Q > why "*p_updates" is needed when you already have "updates' since aren't they the same thing (same value).

Ans : yes they r same , this program demonstrate u how may ways u can access the value..

now if u have some variable say int a = 5;

what does that mean?

u r storing value 5 at some variable a;
now what is this variable a?
its a name to some memory location say OX257D3

now what does a pointer do?
a pointer can store addresses like mentioned above

now if u do
say int *p = &a;

means u r storing the address mentioned abover in this pointer.
now u can access 'a' using this pointer.

use :
across the functions
read about passing parameters to functions.
read about pass by reference

there are many more benifits of having a pointer that u need to study as one cant explain them here.

kunal kislay 0 Light Poster

look it depends on the kind of polynomial and the coeff u r taking..

ax2+bx+c=0 will be increasing function for most value of x if a, b and c are all positive. so you will never get its value less than 0 for most values of x and f(x) will go on increasing over ur while loop and u will stuck in an infinite loop.

n21115 commented: Thanks for your useful suggestions, it helped me a lot. +0
kunal kislay 0 Light Poster

when u start doing any project in VS u have specify what kind of project u r going to do.

so if you want to make a DLL ther is an option to do that..
only extra thing u need to do in your code is exporting the symbols which u want out . that u can find on net decal_export or somthing like that i dont actually remember...

kunal kislay 0 Light Poster

you want to separate string "12345" to int 1 2 3 4 5 right?
try this

string numStr = "12345";  // this is ur input;
int num = atoi(numStr.c_str());
int seperatedNum;
while(num > 0)
{
          seperatedNum = num%10;
          // ptint or stroe seperatedNum whatevr u want
          seperatedNum = num/10;
}

hope this is what u want.

kunal kislay 0 Light Poster

Okey, I've mad the functions virtual, but I dont know how to move on. What should i write for code to execute? How and from where to call it?

Maybe I should show my whole program?

sorry for the delay i was offline..

first u should know how virtual function works...

class vehicle
{

virtual void showType(); // only virtual in this case u can instanciate vehicle
{
           // you can have definition here
}
//or
virtual void showType() = 0;// this is pure virtual u cant instanciate vehicle now , and every derived class form vehicle has to override this function. there cannot be any definition here now. its the contract that derived class will use me as they want 
};

class Car : public vehicle
{
       void showType()
       {
            // u  can have definition here.. if showType() is virtual in base class this function will override base class definition. 
       }
           //if u do not write this function here and showType is only virtual in base class then base class definition will be called.
};

if you still have prob then show me ur code ill help

kunal kislay 0 Light Poster

u r coding in c++..
thare is standard string template class..

try

string temp;
string finalstring;
int a = 65;
char buff[5];
temp = itoa(a,buff,10);
//calcualte the length of temp and append 0 or what ever u want like
temp.length() ; //will give u length of string;

finalstring.append(temp);
finalstring.append("0");//u can replace 0 by others as u required

a = 95;
temp = itoa(a,buff,10);
.
.
finalstring.append(temp);
.
.
.
//and so on..
//then 

int finalint; 
finalint = atoi(finalstring.c_str());

hope this will help

kunal kislay 0 Light Poster

look there are 3 ways a function can be written

first the declaration or prototype eg
return type function(data type identifier);
this is generally used as forward declaration.

int function(int a,......);

second actuall definition of function

int function(int a,float b)
{
..
..
..
}

third is calling that function
there u dont need to write return typa and data type

int main()
{
int a =5;
float b = 6.0;

function(a,b);
return 0;
}
kunal kislay 0 Light Poster

try it at least i think you wont get link errors

give ur virtual function a definition

if it dosent find its derived class definition then it will autometically call ur base definition..

kunal kislay 0 Light Poster

do you need the instantiation of base class in your case.

use the pointer of base class to instantiate derived one..

and i think vehicle should be an abstract class...

//it should be like
vehicle *vech = new Car();

and if you still want to instantiate vehicle dont make the functions pure virtual insteed keep it virtual only
this way ur vehicle class wont be abstract..

kunal kislay 0 Light Poster

do this it will work...

#include<iostream>
#include<map>

using namespace std;

typedef void (*pt2Function)(void);

void hello(void){ cout << "hello world\n"; }

int main()
{
	void (*myPointer)(void) = NULL;
	myPointer = &hello;
// then
	
	map <char *,pt2Function> tempMap;
	tempMap["hello"] = myPointer;



// after all your assignments take them one by one in ur function pointer which ever u want and call

               myPointer = tempMap["hello"];
               myPointer();
	.
	.
	.
	
	return 0;
}
kunal kislay 0 Light Poster

you are makin the object of derived class (car) using base class(vehicle) pointer.. thats correct..

but there should be a pure virtual funtion showType or show in base class which should be overridden in every derived class.

now when u call the show function it will autometically call ur derived class function and will display only what u require.

kunal kislay 0 Light Poster

look for map syntax in net
first and second is not a function.

kunal kislay 0 Light Poster

Try this

#include<iostream>
#include<map>

using namespace std;

typedef void (*pt2Function)(void);

void hello(void){ cout << "hello world\n"; }

int main()
{
	void (*myPointer)(void) = NULL;
	myPointer = &hello;
// then
	
	map <char *,pt2Function> tempMap;
	tempMap["hello"] = myPointer;
	.
	.
	.
	
	return 0;
}

you can access map using itterator;
like

for(map<int,pt2Function >::iterator iter = tempMap.begin() ; iter != tempMap.end() ; iter++)
{
(*iter).first will give u your char * which is function name
(*iter).second is ur function pointer
}
kunal kislay 0 Light Poster

thanks a lot..

kunal kislay 0 Light Poster

hi guys,
i found this site very usefull...
thanks every one for their support

kunal kislay 0 Light Poster

if i pass vectors of vector by reference then internal vectors also get passed by reference?

eg function (vector<vector <int> > &a);