|
If you added this exact path: "D:\Development\GlestOld\xerces-c_2_8_0-x86-windows-vc_8_0\include\xercesc\util" to the include directory, then you need to include "XercesDefs.hpp" and not "xercesc/util/XercesDefs.hpp".
|
|
|
|
|
|
Hi people,
I dont know if anyone can help really, I have got to set up an array of size 20 easy but what i need to do and not sure how to is to randomly assign 6 positions in the array with a 1. Any ideas?
|
|
|
|
|
if u want to fill six positions out of 20 you can use
Array[rand()%20] = somevalue..
are you looking for this functionality?
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
thank you very much do u do thi whilst you are declaring it? or in the main part of code?
|
|
|
|
|
You need to generate
int arr[20]={0};
for(int i=0;i<6;i++)
{
int i = 0 + rand() % (19 - 0);
arr[i]=1;
printf("\n%d",i);
}
for(int i=0;i<19;i++)
{
printf("\n%d",arr[i]);
}
You might also add a condition to check for repetitions in the random generated nos.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
printf("\n%d", what exactly does that do?
|
|
|
|
|
C tutorial needed. Anyway see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Too many trivias today
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
VuNic wrote: int i = 0 + rand() % (19 - 0)
You shouldn't overindulge in beer, in the morning...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hey I thought of saying a word about it but forgot.
Okay, to the OP:
It specifies the range. If you want to generate between, 10 to 20,
You can change it to
int i = 10 + rand() % (20 - 10)
lol that would look funny without the explanation
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
you have lost me i still dont understand wot printf("\n%d", is used for?
|
|
|
|
|
Pardon me, I would want to rewrite my reply.
int arr[20]={0};
for(int i=0;i<6;i++)
{
int i = 0 + rand() % (19 - 0);
arr[i]=1;
}
for(int i=0;i<19;i++)
{
}
Explanation Here[^]
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Neal beavis wrote: ...i still dont understand wot printf("\n%d", is used for?
Did you consult the MSDN page that was mentioned? It says right there in black & white what printf() does.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Anyway there's a flaw, it should be:
int i = 10 + rand() % (21 - 10);
to generate a number ranging from 10 to 20 (including bounds).
In the above example you may also be correct (because you didn't mentionate of including both of the bounds), but in your original post, (19-0) is wrong, because rand() % (19-0) ranges from 0 to 18 (bounds included).
-- Carlo the Nitpick.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all
I am using a database application program using ODBC with MS Access as the database.
While navigating through the database,it is missing a particular row.
my code look like this
m_rs.Open( CRecordset::snapshot, _T( "SELECT * FROM DAUArinc717Frame2" ) );
m_rs.Move( Index );
for(i=0;i<128;i++)
{
data = (BYTE)strtoul( m_edit2, 0, 16 );
str.Format("%d",data);
m_rs.Edit();
m_rs.m_Data = str;
m_rs.Update();
m_rs.MoveNext();
b2 = strtoul( m_edit2, 0, 16 )>> 8;
str.Format("%d",b2);
m_rs.Edit();
m_rs.m_Data = str;
m_rs.Update();
m_rs.MoveNext();
}
I am updating to the database, the values read from the GUI.In this process when i==3,in that particular location in my database(row==264),it is skipping without updating and is moving to the next row.
Please help me..
Thanks in advance
Regards
Deepu
|
|
|
|
|
Deepu Antony wrote: In this process when i==3,in that particular location in my database(row==264),it is skipping without updating and is moving to the next row.
So does Update() throw an (CDBException ) exception?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the reply.
it is working now.I didn't changed anything.Sometimes it happens like that.
Don't know the exact reason
|
|
|
|
|
Hi!
I need help with this problem, I got this error before but I managed to solve.
But now I have a case with the virtual function.
The source looks like this(after the code I continued writing):
#include "stdafx.h"
#ifndef EMPTRANSH
#define EMPTRANSH
#include "Global.h"
#include "iostream"
#include "string"
using namespace std;
class EmpTrans
{
private:
int id;
char emp_name[MAXNAMELENGTH];
employee_status emp_st;
int salary;
salary_type sal_st;
char deal_date[DATELENGTH];
public:
EmpTrans();
static void Open();
static void Close();
void ReadNext();
virtual void Apply();
void UpdateId(int i){id = i;}
void UpdateSalary(int s){salary = s;}
void UpdateEmployeeStatus(employee_status es){emp_st = es;}
void UpdateSalaryType(salary_type ss){sal_st = ss;}
void UpdateDate(char * d){strcpy(deal_date,d);}
void UpdateEmployeeName(char en){emp_name[0] = en;}
int GetId(){return id;}
char * GetEmployeeName(){return emp_name;}
employee_status GetEmployeeStatus(){return emp_st;}
int GetSalary(){return salary;}
salary_type GetSalaryType(){return sal_st;}
char * GetDate(){return deal_date;}
};
#endif
class EmpTransAdd : public EmpTrans
{
public:
void Apply();
};
class EmpTransChange : public EmpTrans
{
public:
void Apply();
};
class EmpTransDelete : public EmpTrans
{
public:
void Apply();
};
When I compile and link this source I get the error,
when I remove the virtaul function from the Apply function, everything works fine.
What is the problem?
Do I need to take out the other classes from the source? or to include them inside the ifdef?
Thanks
|
|
|
|
|
You don't provide a body for the EmpTrans::Open(), EmpTrans::Close(), EmpTrans::Apply functions (well at least you didn't show us). You still need to provide a body for those functions in the base class, unless they are pure virtual functions (e.g. virtual void Apply() = 0; ), in which case it is mandatory that each child classes implement this function.
|
|
|
|
|
Will u pls show the code which creates the instance of ur class EmpTrans?
you have to provide the definition of Apply() in the base class. else it have to be a pure virtual function.
modified on Tuesday, March 24, 2009 6:44 AM
|
|
|
|
|
if you do not have implementation for virtual void Apply() in class EmpTrans, you should make it.
virtual void Apply()=0 A pure virtual function,
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
hi guys,
i am developing a worm scanner..
i have to choose the directories from Folder Browser Dialog..
when i does that i will get the directory C:\NVIDIA\Win2KXP
but i need to convert it to C:\\NVIDIA\\Win2KXP so that i can get the file names in the that directory using ListFiles......
since the symbol \ i could not put \ between "" and ''
how can i solve this ya??
help me plz...
|
|
|
|