|
See Email on the http://www.codeguru.com/cpp/i-n/internet/
|
|
|
|
|
could someone pls help me i am trying to create a a wav to mp3 convertor but i have no clue how to start ,could someone guide me to how to create the converter
ty in advance
|
|
|
|
|
Dearch on Codeproject or search Googel for "madlib".
|
|
|
|
|
Did you search on the codeproject(Audio/Video)?
|
|
|
|
|
need to make a dsn less connection to a file whose path is known. my present code connects to dsn..
m_retcode = SQLAllocHandle(SQL_HANDLE_DBC, m_henv, &m_hdbc);
m_retcode = SQLDriverConnect(m_hdbc, NULL, (unsigned char *)pConString, SQL_NTS, NULL, 0, &m_constrout, SQL_DRIVER_NOPROMPT);
what should the parameters be now?
thanks
apoorva
|
|
|
|
|
Have you come across this article already? DSN-less[^] If not, check it out as it has some really useful info on DSN-less connection strings
|
|
|
|
|
Hi all,
I am just new to progamming .I am writng small twenty card game.What I want I dont repeat the cards again to next player after first user received.And in real I wana do game with more than two player.But in my code have some problem with print out total score that who win or lose (only two player is ok).I can get total score by comparing two player. But I want to compare with more than two players.How can I do with my code.
here is my simple code.. Thanks in advance.
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
void display();
void intro();
int your_total(int urcard);
int comp_total(int compcard);
struct{
int face;
unsigned int value;
}
card[13] =
{ {'2', 2},{'2', 3},{'2', 4},
{'5', 5},{'6', 6},{'7', 7},
{'8', 8},{'9', 9},{'X', 10},
{'J', 13},{'Q', 12},{'K', 11},
{'A', 1}
};
char suit[4]={'D','C','H','S'};
int main()
{
intro();
display();
return 0;
}
void intro()
{
cout<<"simple twenty one card"<<endl;
cout<<"------------------------"<<endl;
cout<<"Total number gotta cut out upon number21!"<<endl;
cout<<"But u can have only 5 cards in maximum"<<endl;
cout<<"<TenX=10,King=11,Queen=12,Jack=13,Ace=1>"<<endl<<endl;
}
int your_total(int urcard)
{
int urtotal=0;
srand((unsigned)time(0));
cout<<"How many cards u want?(up to 5 cards)"<<endl;
cin>>urcard;
if (urcard>5)
cout<<"You could not get more than five cards!"<<endl;
else
{
cout<<" Ur card"<<endl;
for (int ucard=0;ucard<urcard;ucard++)
{
int x = rand() % 13;
char d;
d=rand()%4;
cout<<" |"<<suit[d];
printf("%c| ", card[x].face);
urtotal+=card[x].value;
if(urtotal>42)
urtotal=urtotal-30;
else if(urtotal>31&&urtotal<42)
urtotal=urtotal-20;
else if(urtotal>21&&urtotal<32)
urtotal=urtotal-10;
}
}
return urtotal;
}
int comp_total(int compcard)
{
srand((unsigned)time(0));
cout<<endl<<"How many cards you want computer?"<<endl;
int lowest=2, highest=5;
int range=(highest-lowest)+1;
int total_num=0;
for(int index=0; index<1; index++){
compcard= lowest+int(range*rand()/(RAND_MAX + 1.0));
cout <<compcard<<endl;
}
cout<<" My cards"<<endl;
for (int Ccard=0;Ccard<compcard;Ccard++)
{
int x = rand() % 13;
char d;
d=rand()%4;
cout<<" |"<<suit[d];
printf("%c| ", card[x].face);
total_num+=card[x].value;
if(total_num>42)
total_num=total_num-30;
else if(total_num>31&&total_num<42)
total_num=total_num-20;
else if(total_num>21&&total_num<32)
total_num=total_num-10;
}
return total_num;
}
void display()
{
int comptotal, urtotal,person=0,computer=0, compscore=0,urscore=0,draw=0;
const int high=21;
char cond;
int ur;
do{
srand((unsigned)time(0));
urtotal=your_total(person);
comptotal=comp_total(computer);
cout<<endl<<"I have "<<comptotal<<" and you have "<<urtotal<<" so ";
if(comptotal<=high&& urtotal<comptotal)
{
cout <<"I win! "<<endl;
compscore++;
}
else if(comptotal<=high&& urtotal>high)
{
cout <<"I win! "<<endl;
compscore++;
}
else if (urtotal<=high&& urtotal>comptotal)
{
cout<<" you win!"<<endl;
urscore++;
}
else if (urtotal<=high&& comptotal>high)
{
cout<<" you win"<<endl;
urscore++;
}
else
{
cout<<"no win"<<endl;
draw++;
}
cout<<endl<<"Wana play again(n/y?)"<<endl;
cin>>cond;
}while(cond=='y');
cout<<"I win: "<<compscore<<endl<<"U win: "<<urscore<<endl<<"Draw : "<<draw<<endl;
cin>>ur;
}
|
|
|
|
|
How to create custom controls using XAML in visual studio 2005?
|
|
|
|
|
You can't, in C++. You need to use C# or VB.NET.
You also can't without installing WPF, obviously.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi guys
i want to ask how to remove a program in startup by code or by CMD
if any one know solution in java it'll be great
thnx
|
|
|
|
|
Alinuxcs wrote: if any one know solution in java it'll be great
if you know how to access registry through JAVA, then key location is
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Sir
the program that i want to remve is not in this location
i could found it only in msconfig
but its key in registry cant find it in this location
neither local machine or current user
thank u any way
|
|
|
|
|
Is there anybody out there that has managed to get this counter to work?
I am trying to expose an average timer from my application,
but feeding exactly the same inputs into the Win32 API
and the .Net framework yields two different results,
performance monitor reports the fixed value of 1200 for the Win32 logic
performance monitor reports the correct average time per operation
for the .Net framework logic
Into the Average Timer I am feeding the elapsed time
from the difference of two calls to QueryPerformanceCounter
Into the Average Base I am feeding the number of operations performed
(which is typically 1)
I have found references on the net where other people have encountered this problem - but no solution
I would be VERY grateful for any guidance...
Regards,
Martin...
-- modified at 18:35 Monday 1st January, 2007
|
|
|
|
|
I'm generating an animation on the screen and the screen saver kicks in since there is no keyboard/mouse interaction from the user.
Is there any MFC/Win32 to reset the screen saver timer ? Worst comes to worse I might try a SendMessage() with WM_COMMAND/BN_CLICKED periodically to simulate user interaction but there must be some more elegant solution.
Thanks for your input
Alex
asta la vista baby
|
|
|
|
|
You could try using the SystemParametersInfo() function with the SPI_SETSCREENSAVEACTIVE action.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Call SetThreadExecutionState(ES_DISPLAY_REQUIRED) to tell the system that you're using the display.
|
|
|
|
|
From MSDN[^]:
[quote]
This function does not stop the screen saver from executing either.
[/quote]
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Those docs need some cleanup, since they also say:Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED when they display video for long periods of time without user input.
|
|
|
|
|
helo all
i wrote a list like class , i tested it with int type and it works but now i want to make it a template.
when i change it to template i got :
Error 4 error LNK2019: unresolved external symbol "public: __thiscall vector_eu<int>::vector_eu<int>(void)" (??0?$vector_eu@H@@QAE@XZ) referenced in function _wmain
from all the functions i declared outside the class.
i tried to put all the code in a singal file and it works fine, but i don't want this .
i want to have the class declarations in a header file the functions in a CPP file so if i want to use the list later all i have to do is to includ the header file and add the CPP file into my project.
here is the code :
<br />
#include <iostream><br />
<br />
using namespace std;<br />
<br />
template <typename tip><br />
class element <br />
{public:<br />
tip val;<br />
int initializat; element<tip>* point_front;<br />
element<tip>* point_back;<br />
<br />
};<br />
<br />
<br />
template <typename tip><br />
class vector_eu<br />
{<br />
public:<br />
vector_eu();
int push_bak(tip);
int insert(tip,int);
int erace(int);
int erace(int,int);
int clear(void);
int get(int); <br />
<br />
private:<br />
element<tip>* primul_element;<br />
int nr_de_elemente;<br />
element<tip>* ultimul_element;<br />
<br />
element<tip>* get_addres(int);<br />
<br />
<br />
};<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
#include "stdafx.h"<br />
#include <iostream><br />
#include <string><br />
#include "define element.h"<br />
using namespace std;<br />
<br />
void error(string s)<br />
{<br />
cout<<s<<endl;<br />
}<br />
<br />
<br />
template <typename tip><br />
inline <br />
vector_eu<tip>::vector_eu()<br />
{<br />
this->nr_de_elemente=0;<br />
this->primul_element=new element<tip>;
this->primul_element->initializat=0; <br />
this->primul_element->point_back=0;
this->primul_element->point_front=0;
this->ultimul_element=this->primul_element; <br />
}<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::push_bak(tip val)<br />
{<br />
if((this->nr_de_elemente)==0)<br />
{<br />
(this->primul_element)->initializat=1;<br />
(this->primul_element)->val=val;<br />
++(this->nr_de_elemente);<br />
return 1;<br />
}<br />
else<br />
{<br />
element<tip> * temp=new element;<br />
temp->initializat=1;<br />
temp->val=val;<br />
temp->point_front=0;<br />
temp->point_back=(this->ultimul_element);<br />
(this->ultimul_element)->point_front=temp;<br />
(this->ultimul_element)=temp;<br />
++(this->nr_de_elemente);<br />
return 1;<br />
}<br />
}<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
element<tip>* vector_eu<tip>::get_addres(int n) {<br />
if (this->nr_de_elemente==0)<br />
{<br />
error("nu exista elemente");<br />
return 0;<br />
}<br />
else<br />
{ if(n<this->nr_de_elemente)<br />
{<br />
if(n==0) return this->primul_element;<br />
else<br />
{<br />
if(n<0){ error("iterator<0");return 0;}<br />
else<br />
{<br />
element<tip>*temp=this->primul_element; <br />
while(n>0)<br />
{<br />
temp=temp->point_front;<br />
--n;<br />
}<br />
return temp;<br />
}<br />
}<br />
}<br />
else <br />
{<br />
error("iterator>nr_de_elemente");<br />
}<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::get(int n)<br />
{<br />
if(this->nr_de_elemente>n)<br />
{<br />
if(n>-1)<br />
{<br />
element<tip> * temp =get_addres(n);<br />
return temp->val;<br />
}<br />
else {<br />
error("iterator<0");<br />
return 0;<br />
}<br />
}<br />
else {<br />
error("iterator>nr_de_elemente");<br />
return 0;<br />
}<br />
}<br />
<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::clear(void) <br />
{<br />
if(this->nr_de_elemente!=0)<br />
{<br />
if(this->nr_de_elemente>0)<br />
{<br />
element<tip>* temp=this->ultimul_element;<br />
while(this->nr_de_elemente>1)<br />
{<br />
temp=temp->point_back;<br />
delete (temp->point_front);<br />
--(this->nr_de_elemente);<br />
}<br />
temp->point_front=0;<br />
temp->initializat=0;<br />
temp->val=0;<br />
(this->ultimul_element)=(this->primul_element);<br />
(this->nr_de_elemente)=0;<br />
return 1;<br />
}<br />
else {error("nr_de_elemente<0");return 0;}<br />
}<br />
else<br />
return 1;<br />
}<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::erace(int n) <br />
{<br />
if(n<this->nr_de_elemente)<br />
{<br />
if(n>-1)<br />
{ <br />
if(n==0)<br />
{ <br />
if(this->nr_de_elemente==1)<br />
{<br />
this->clear();<br />
}<br />
else<br />
{<br />
element<tip> *temp=this->primul_element;<br />
this->primul_element=(this->primul_element)->point_front;<br />
(this->primul_element)->point_back=0;<br />
delete temp;<br />
--(this->nr_de_elemente);<br />
return 1;<br />
}<br />
}<br />
else{<br />
if((n+1)==this->nr_de_elemente)<br />
{<br />
element<tip> * temp=this->ultimul_element;<br />
((this->ultimul_element)->point_back)->point_front=0;<br />
(this->ultimul_element)=(this->ultimul_element)->point_back;<br />
delete temp;<br />
--(this->nr_de_elemente);<br />
return 1;<br />
}<br />
else<br />
{<br />
element<tip> * temp=get_addres(n);<br />
(temp->point_back)->point_front=temp->point_front;<br />
(temp->point_front)->point_back=temp->point_back;<br />
delete temp;<br />
--(this->nr_de_elemente);<br />
return 1;<br />
}<br />
}<br />
}<br />
else error("iterator<0");<br />
<br />
}<br />
else error("iterator>nr_de_elemente");<br />
<br />
return 0;<br />
}<br />
<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::erace(int n, int r) { <br />
if(n<0)<br />
{<br />
error("iterator poz<0");<br />
return 0;<br />
}<br />
else<br />
if(r<0) <br />
{<br />
error("iterator lungime<0");<br />
return 0;<br />
}<br />
else<br />
if(r==0)<br />
{<br />
error("iterator lungime = 0");<br />
}<br />
else<br />
if((n+r)>(this->nr_de_elemente))<br />
{<br />
error("depaseste dimensiunea");<br />
return 0;<br />
}<br />
else<br />
{<br />
if(r==1) <br />
{<br />
erace(n);<br />
return 1;<br />
}<br />
else<br />
if(n==0)<br />
{<br />
if(r==(this->nr_de_elemente))<br />
{<br />
this->clear();<br />
return 1;<br />
}<br />
else<br />
{ <br />
element<tip> * temp=(this->primul_element);<br />
for(int i=0;i<r;++i)<br />
{<br />
temp=(temp->point_front);<br />
delete (temp->point_back); <br />
<br />
}<br />
(this->primul_element)=temp;<br />
(this->primul_element)->point_back=0;<br />
this->nr_de_elemente-=r;<br />
return 1;<br />
}<br />
}<br />
else<br />
{<br />
if((n+r)==(this->nr_de_elemente))<br />
{<br />
element<tip> *temp=get_addres(n);<br />
(this->ultimul_element)=temp->point_back;<br />
(this->ultimul_element)->point_front=0;<br />
for(int i=1;i<r;++i)<br />
{<br />
temp=temp->point_front;<br />
delete temp->point_back;<br />
}<br />
delete temp;<br />
this->nr_de_elemente-=r;<br />
return 1;<br />
}<br />
else<br />
{<br />
element<tip> *temp=get_addres(n);<br />
element<tip> *temp_2=(get_addres(n-1));<br />
element<tip> *temp_3=get_addres(n+r);<br />
temp_2->point_front=temp_3;<br />
temp_3->point_back=temp_2;<br />
for(int i=1;i<r;++i)<br />
{<br />
temp=temp->point_front;<br />
delete temp->point_back;<br />
}<br />
delete temp;<br />
this->nr_de_elemente-=r;<br />
return 1;<br />
}<br />
<br />
}<br />
}<br />
}<br />
<br />
<br />
template <typename tip><br />
inline<br />
int vector_eu<tip>::insert(tip val, int n) <br />
{ <br />
if((n==0)&&(this->nr_de_elemente==0))<br />
this->push_bak(val);<br />
else<br />
if(n>this->nr_de_elemente)<br />
{<br />
error("iterator>nr_de_elemente");<br />
return 0;<br />
}<br />
else<br />
if(n<0)<br />
{<br />
error("iterator<0");<br />
return 0;<br />
}<br />
else<br />
if(n==this->nr_de_elemente)<br />
{<br />
this->push_bak(val);<br />
<br />
return 1;<br />
}<br />
else<br />
if(n==0)<br />
{<br />
element<tip> * temp=new element<tip>();<br />
temp->initializat=1;<br />
temp->point_back=0;<br />
temp->point_front=this->primul_element;<br />
(temp->val)=val;<br />
(this->primul_element)->point_back=temp;<br />
this->primul_element=temp;<br />
++(this->nr_de_elemente);<br />
return 1;<br />
}<br />
else<br />
{<br />
element<tip> * temp=get_addres(n-1);<br />
element<tip> * new_element= new element<tip>();<br />
<br />
new_element->initializat=1;<br />
new_element->val=val;<br />
<br />
new_element->point_front=temp->point_front;<br />
(temp->point_front)->point_back=new_element;<br />
temp->point_front=new_element;<br />
new_element->point_back=temp;<br />
++(this->nr_de_elemente);<br />
return 1;<br />
<br />
}<br />
<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
#include "stdafx.h"<br />
#include "define element.h"<br />
#include <iostream><br />
<br />
using namespace std;<br />
<br />
int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
int a,b,c;<br />
<br />
vector_eu<int> e;<br />
while(1)<br />
{ <br />
<br />
cout<<endl<<endl;<br />
cout<<"1. push_bak"<<endl; <br />
cout<<"2. insert"<<endl;<br />
cout<<"3.clear"<<endl;<br />
cout<<"4.get"<<endl;<br />
cout<<"5.erace(int)"<<endl;<br />
cout<<"6.erace(int,int)"<<endl;<br />
cin>>a;<br />
if(a==0) break;<br />
switch (a)<br />
{<br />
case 1:<br />
cout<<" val= ";<br />
cin>>b;<br />
<br />
e.push_bak(b);<br />
break;<br />
case 2:<br />
cout<<"val= ";<br />
cin>>b;<br />
cout<<" poz= ";<br />
cin>>c;<br />
e.insert(b,c);<br />
break;<br />
case 3:<br />
e.clear();<br />
break;<br />
case 4:<br />
cout<<"poz= ";<br />
cin>>b;<br />
cout<<"e["<<b<<"]= "<<e.get(b);<br />
break;<br />
case 5:<br />
cout<<"poz= ";<br />
cin>>b;<br />
e.erace(b);<br />
break;<br />
case 6:<br />
cout<<"poz= ";<br />
cin>>b;<br />
cout<<"lungme= ";<br />
cin>>c;<br />
e.erace(b,c);<br />
break;<br />
<br />
}<br />
<br />
}<br />
<br />
std::system("pause");<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
Because of how templates work all the code for template classes have to be in the *.h header files. You can not split them between header and *.cpp source files.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
posting a kilometer of code (not even respecting the posting guidelines) will not help as i doubt one will take time to analyse your whole code.
you have to do the tracking yourself first, and then ask about a specific point, providing only the piece of code around where the problem comes from...
|
|
|
|
|
Wat do u expect from us sir,
To rewrite the whole for u
Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself.
G. C. Lichtenberg (1742-99), German physicist, philosopher.
SH UVIK
|
|
|
|
|
sorry!!!!!!
i'm not expecting that u rewrite my code.
i'll try to falow toxcct's advice.
|
|
|
|
|
dear all
iam working on a finger preassure sensing by a touchpad so if you can help me i need to know how can i take yhe preassure from it by visual c++
thanx allot
ahmad al-omar
|
|
|
|
|
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.
|
|
|
|
|