HINT : :)
Dim sel_row_index As Integer
Dim sel_col_index As Integer
Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
sel_row_index = e.RowIndex
sel_col_index = e.ColumnIndex
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show(DataGridView1.Item(sel_col_index, sel_row_index).Value.ToString)
End Sub
hope this can help...:)
void getToken(char myString[], char *_return_value[])
{
//...
}
what project...a virus...???...i need to know...
ERROR :
at line,
58... getline(bookDataFile, books[noOfBooks].category,);
121...What is author
...i don't know, do u know?...
117-128...dont need it yet, u can remove it...
//....
else if(select==2) {
cout << "\nSolve the puzzle:";
//----
cin.ignore();
//----
getline(cin,solve);
//....
}
about char *my_char = new char[];
yes. it does compile...:-O
I just confuse with the statement below..
To allocate n bytes
of storage suitably aligned to represent any array object of that size or smaller. The program can define a function with this function signature that replaces the default version defined by the Standard C++ Library. The required behavior is the same as for operator new(unsigned int)
. The default behavior is to return operator new(n).
but thanks..
And if you don't specify an n, then what?
I apologize, May I ask u some question..
??? What the difference between :
char *my_char = new char(5);
// and..
char *my_char = new char[5];
??? In this case. Isn't it true that is same as :
char *my_char = new char();
// or...
char *my_char = new char[];
To allocate n bytes of storage suitably aligned to represent any array object of that size or smaller. The program can define a function with this function signature that replaces the default version defined by the Standard C++ Library. The required behavior is the same as for operator new(unsigned int). The default behavior is to return operator new(n).
Here's a sample code..
// using bubble sort algorithm
// components:
// 1. ListBox1
// 2. ListBox2
// "header.h"
// ...
class TForm1:public TForm
{
// ...
private:
void __fastcall swap(int,int);
void __fastcall sort(void);
// ...
};
// "source.cpp"
// ...
void __fastcall TForm1::swap(int i1,int i2)
{
AnsiString temp="";
temp=ListBox1->Items->Strings[i1];
ListBox1->Items->Strings[i1]=ListBox1->Items->Strings[i2];
ListBox1->Items->Strings[i2]=temp;
}
//---------------
// ListBox2 items:
//---------------
// ABC.TXT
// CCCCMMYYYYSSDD.TXT
// 0404190300CCCC.TXT
// CCCCYYYYSSDDMM.TXT
// 0202190101CCCC.TXT
// CCCCSSDDMMYYYY.TXT
// 0101190002CCCC.TXT
// 123456.TXT
// Sorting...
void __fastcall TForm1::sort(void)
{
ListBox1->Items=ListBox2->Items;
int i_count=ListBox1->Items->Count;
for(int i=n_size;i>=0;i--)
for(int j=0;j<i_count-1;j++)
{
AnsiString t1=ListBox1->Items->Strings[j];
AnsiString t2=ListBox1->Items->Strings[j+1];
if(t1>t2)
swap(j,j+1);
}
}
simply
CString str = "Check";
char *my_char = new char[];
sprint(my_char,"%ls",str.GetBuffer());
try this...
char month[3] = {NULL};
etc..
try if (e->Button::get() == Buttons::Right)
Determining velocity value..
float theta, float cotheta
..etc..That's wrong..Should be float theta, cotheta
..etc..
#include <iostream>
#include <cmath>
using namespace std;
const float G = 32.17;
// function declaration
float caltime ( float,float, float );
float calheight ( float,float,float);
// main function
int main()
{
// here u go
float theta, /*float*/ cotheta, /*float*/ sitheta, /*float*/ distance, /*float*/ velocity, /*float*/ time, /*float*/ height;
cout << " Input the angle of elevation : " << endl;
cin >> theta;
cotheta = cos(theta);
sitheta = sin (theta);
cout << " Input the distance : " << endl ;
cin >> distance;
//use function
time = caltime ( distance,velocity, cotheta);
height = calheight ( velocity, sitheta, time) ;
cout << " The flight will reach in the target within"<< time << "second " << endl;
cout << " The height will be " << height << "ft above the ground" << endl;
system ("pause");
return 0;
}
float caltime ( float x, float y, float z)
{
float timefind;
timefind = x/(y * cotheta);
return timefind;
}
float calheight (float a,float b, float c)
{
float heightfind;
heightfind = ( a * b * c - (G * c*c /2))
return heightfind;
}
Place them in the dialog header n source file..not in the main header file..
->printf..what for..
That code is a dodge, don't u..
Assert : typically used to identify logic error by implementing the expression arg to evaluate to false only..
Ex.
char ch = 'a';
assert(ch != 'a') // assertion failure..
//expression is false..
I dont know whether this is a loop or non..Try this at ur own risk..
void CALL_ME CLSL::functB()
{
std::cout<<"hello world"<<std::endl; //,..,
functA();
}
void CALL_ME CLSL::functA()
{
functB();
}
Do you have dialog header file?..
class "dialog":public CDialog
{
//...
protected:
// add this..
afx_msg void OnClose();
};
// dialog cpp
BEGIN_MESSAGE_MAP("dialog",CDialog)
//...
ON_WM_CLOSE()
END_MESSAGE_MAP()
void "dialog"::OnClose()
{
//TODO: Place your code here to handle when the dialog is closed
}
1. x as integer
2. y as integer
3. operator as char
4. get x from users
5. get y from users
6. get operator from users
7. switch operator, case '+': result=x+y
, etc.
8. display result
9. while
repeat, goto step 4
10. done.
No u dont..
long factorial(long i) { printf("%d, ",i); if(i==0) return 1; return (i * factorial(i-1)); } getch();
is STILL in your for loop so why do you expect it should work?
plus..
int main()
{
int i=factorial(5);
return 0;
}
long factorial(long i)
{
if(i==0)
return 1;
else
return (i * factorial(i-1));
}
'curl.h'!!..using class or not?..
Here's a sample code..
class CAvg
{
private:
int s;
double data[3];
double avg(void)
{
double result=0.0;
for(size_t i=0;i<3;i++)
result+=data[i];
return result/3.0;
}
public:
CAvg():s(0){}
double getTestScore(const double _data)
{
if(s<=2)
{
data[s]=_data;
if(s==2)
return avg();
s++;
}
return 0.0;
}
};
int main()
{
CAvg av;
double average=0.0;
double inp=0.0;
for(size_t i=0;i<3;i++)
{
std::cout<<"score "<<i+1<<" : ";
std::cin>>inp;
average=av.getTestScore(inp);
}
std::cout<<"Average = "<<average;
}
K then..
bool check(const std::string str)
{
int s=(int)str.length();
std::string t;
for(int i=s-1;i>=0;i--)
t.push_back(str[i]);
return ((stricmp(str.c_str(),t.c_str())==0)?true:false);
}
std::string palindrome(const std::string str)
{
int s=(int)str.length();
std::string lons;
for(int i=0;i<s;i++)
for(int j=s-1;j>i;j--)
{
std::string n=str.substr(i,j-i+1);
if(check(n))
if(n.length()>lons.length())
lons=n;
}
return lons;
}
int main()
{
std::string m_str=palindrome("bustdlrow ollehhellodush");
std::cout<<m_str.c_str();
std::cin.get();
return 0;
}
>Read carefully..
Why should I read carefully when you obviously can't? I can only assume you read the problem backward. Props for trying to find a pattern in random input though.
???..Yeah..U right..I dont finish to read its problems..
???...???...
string name
name[0]=toupper(name[0])
for i=0 to namelen
begin
if name[i]='space' then
begin
i=i+1
name[i]=toupper(name[i])
end
i=i+1
end
Why should the last letter be capital?
Read again..U will know..
Read carefully..
string name
k=0
for i to namelength
begin
if name[i]='space' or i=0 or i=namelength then
begin
j=(i+k)/2
name[j]=toupper(name[j])
k=i
end
end
Or...
bool check(const std::string str, const std::string ori)
{
return ((stricmp(str.c_str(),ori.c_str())==0)?true:false);
}
std::string palindrome(const std::string str)
{
int size=str.length();
std::string reverse_str;
for(int i=((size)-1);i>=0;i--)
reverse_str.push_back(str[i]);
if(check(reverse_str,str))
return reverse_str;
return "it's not a palindrome";
}
int main()
{
std::string m_str=palindrome("dlrow olleh hello world");
std::cout<<m_str.c_str();
std::cin.get();
return 0;
}
This is a simple algorithm..You can learn from this..
#define MAX 128
bool check(const char *str, const char *ori)
{
return ((stricmp(str,ori)==0)?true:false);
}
std::string palindrome(const char *str)
{
int size=strlen(str);
if(size>=MAX)
return "failed";
char reverse_str[MAX]={NULL};
for(int i=0,j=((size)-1);i<size;i++,j--)
reverse_str[i]=str[j];
if(check(reverse_str,str))
return reverse_str;
return "it's not a palindrome";
}
int main()
{
std::string m_str=palindrome("dlrow olleh hello world");
std::cout<<m_str;
std::cin.get();
return 0;
}
Um..Sorry..
void change(float dollar,int &hundreds, int &fifties, int &twenties, int &tens, int &fives, int &ones)
{
int total=0;
hundreds=dollar/100;
total=((int)dollar
%100);
fifties=total/50;
total=((int)dollar%50);
twenties=total/25;
total=((int)dollar%25);
tens=total/10;
total=((int)dollar%10);
fives=total/5;
total=((int)dollar%5);
ones=total/1;
return;
}
I'm not sure..
void change(float dollar,int &hundreds, int &fifties, int &twenties, int &tens, int &fives, int &ones)
{
int total=0;
hundreds=dollar/100;
total=((int)dollar
%100);
fifties=total/50;
total=((int)dollar%50);
twenties=total/20;
total=((int)dollar%20);
tens=total/10;
total=((int)dollar%10);
fives=total/5;
total=((int)dollar%5);
ones=total/1;
return;
}
#include <iostream>
using namespace std;
void change(float,int &,int &,int &,int &,int &,int &);
int main()
{
float dollar;
int hundreds,fifties,twenties,tens,fives,ones;
cout << "Enter dollar amount :\n";
cin >> dollar;
change(dollar,hundreds,fifties,twenties,tens,fives,ones);
cout << "Least change of" << dollar << "is...";
cout << "Hundreds :" << hundreds;
cout << "Fifties :" << fifties;
cout << "Twenties :" << twenties;
cout << "Tens :" << tens;
cout << "Fives :" << fives;
cout << "Ones :" << ones;
}
void change(float dollar,int &hundreds, int &fifties, int &twenties, int &tens, int &fives, int &ones)
{
hundreds = dollar/100;
fifties = dollar/50;
twenties = dollar/20;
tens = dollar/10;
fives = dollar/5;
ones = dollar/1;
return;
}
How about this
#include <iostream>
using namespace std;
void change(float,float &,float &,float &,float &,float &,float &);
int main()
{
float dollar;
float hundreds,fifties,twenties,tens,fives,ones;
cout << "Enter dollar amount :\n";
cin >> dollar;
change(dollar,hundreds,fifties,twenties,tens,fives,ones);
cout << "Least change of" << dollar << "is...";
cout << "Hundreds :" << hundreds;
cout << "Fifties :" << fifties;
cout << "Twenties :" << twenties;
cout << "Tens :" << tens;
cout << "Fives :" << fives;
cout << "Ones :" << ones;
}
void change(float dollar,float &hundreds, float &fifties, float &twenties, float &tens, float &fives, float &ones)
{
float total=0.0;
while(total >=0.0)
{
hundreds = dollar/100.0;
total = total - hundreds;
fifties = dollar/50.0;
total = total - fifties;
twenties = dollar/20.0;
total = total - twenties;
tens = dollar/10.0;
total = total - tens;
fives = dollar/5.0;
total = total - fives;
ones = dollar/1.0;
total = total - ones;
}
return;
}
This for free..Enjoy..
#include <iostream>
using namespace std;
void change(float,float &,float &,float &,float &,float &,float &);
int main()
{
float dollar;
float hundreds,fifties,twenties,tens,fives,ones;
cout << "Enter dollar amount :\n";
cin >> dollar;
change(dollar,hundreds,fifties,twenties,tens,fives,ones);
cout << "Least change of" << dollar << "is...";
cout << "Hundreds :" << hundreds;
cout << "Fifties :" << fifties;
cout << "Twenties :" << twenties;
cout << "Tens :" << tens;
cout << "Fives :" << fives;
cout << "Ones :" << ones;
}
void change(float dollar,float &hundreds, float &fifties, float &twenties, float &tens, float &fives, float &ones)
{
float total=0.0;
while(total >=0.0)
hundreds = dollar/100.0;
total = total - hundreds;
fifties = dollar/50.0;
total = total - fifties;
twenties = dollar/20.0;
total = total - twenties;
tens = dollar/10.0;
total = total - tens;
fives = dollar/5.0;
total = total - fives;
ones = dollar/1.0;
total = total - ones;
return;
}
Solved or not..??..
Use cin.getline(name,size) to read a string..To display..Simply..
d_recread(&bookrec);
for (status=d_keyfrst(INFO_TITLE);status==S_OKAY;status=d_keynext(INFO_TITLE))
{
//...
}
//...
What is d_recread?..Where is it?..
Use getline()
instead of >>
..Agree..
Ex:
int varA=0;
// ...
cin>>varA;
char strA[15];
// ...
cin.getline(strA,15);
i don't know what should i say in English..Hope this can help u..
Well..Then use strcat
file="\\default.txt"
if pathlength+filelength > limit
return 1
strcat(Path,file);
#include <iostream>
#include <iomanip>
using namespace std;
double CalculateCharges (double car1=1.5,double car2=2.0,double car3=24.0);
int main ()
{
cout<<" Parking Garage Rates " << endl;
cout<<"Car"<<"Hours"<<"Charge"<<endl;
// double rate
for (int i=1;i<=3;i++)
cout<<i<<" "<<CalculateCharges()<<endl;
cout<<"Total"<<endl;
return 0;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
double CalculateCharges(double car1, double car2, double car3)
{
double hours[3];
hours[0]=car1;
hours[1]=car2;
hours[2]=car3;
int b;
double rate =0;
for( b = 0; b <= 2; b++ ){
hours[b] += (hours[0]+hours[1]+hours[2]);
for (double h=0;h<=24;h+=hours[b])
{
if (h<3)
rate = 2.00;
else if (h>3)
{
rate = (.50*h);
}
else if ( h == 24 )
{
rate = 10.00 ;
}
}
return rate;
}
}
Missing ';' symbol..
class oopy
{
//...
}; // <- this line...
And replace
Oopy::Oopy()
{...}
with this..
oopy::oopy()
{...}
// and so on
Not true..
1. Use braces
{...}
instead of parentheses for initializator-list.
that is true..
try to use if..else if..else..
bool answer = true..
const int arraylength = 5;
int array[arraylength]={1,3,5,2,4};
//...mrboolf code
My bad..Thank u very much..
Back to the owner of this problem..
counter=0, not counter-0
Reset num back to 0..
while(blah..blah)
(
num=0;
//...
num=num+(1.0/denom);
)
//...
Ship old_ship;
Ship *new_ship=new Ship;
old_ship.overlaps(new_ship);
//...
i'm not sure too..