Tuesday, July 14, 2009

In flash: Movie A has a frame rate of 24 fps. Movie B has a frame?

2 What is the difference between Event sounds and Stream


sounds?





3 Briefly explain what the following line of code does:


var foo:Tween = new Tween(title, "_alpha", Back.easeOut, 10, 80, .5, true);





4 What keyword allows new properties or methods to be


added to a class at run time?


A. void


B. final


C. static


D. dynamic





5 Where can I expect to find the Class file for the


following Classes assuming that I have not modfied the


import path in the Flash settings.


A. import com.lemans.gui.GenericButton;


B. import net.lollypop.Candy;


C. import MonsterTruck;





6 What happens when you select Control %26gt; Test Movie with


the following code in the first frame of a movie?


MyArray =["one", "two", "three"];


for (i=0, i%26lt;myArray.length, i++){


trace(myArray[i]);


}


A. Nothing is seen because trace statements are ignored


B. It does not compile generating an error in the


Output panel.


C. The developer should put "var " in front of the


first occurrence of the 'i' variable.


D. The developer should first store myArray.length in


a variable and use that variable in place of


myArray.length.


E. The developer must cast myArray as an array by


changing the first line to:


myArray:Array =["one", "two", "three"];

In flash: Movie A has a frame rate of 24 fps. Movie B has a frame?
Wow this is a long process and need to have a long answer, try posting to any flash forums.


Astronomy homework questions. Please help!!!!!?

If you're not POSITIVE about one of them, then please let me know!








1. The main method of energy generation in protostars is


a. hydrogen fusion


b. nuclear fission


c. static discharge


d. gravitational collapse


e. trick question, protostars do not generate energy








2. As a star exhausts hydrogen in its core, it


a. becomes hotter and more luminous


b. becomes cooler and more luminous


c. becomes hotter and less luminous


d. becomes coller and less luminous


e. it becomes larger in radius and hotter.








3. A star will experience a helium flash if


a. it is more massive than about 6 solar masses


b. its core contains oxygen and helium


c. its mass on the main sequence was less than 0.1 solar masses


d. it is a supergiant


e. its core is degenerate when helium ignites





4. The main factor controlling the evolution of a star is


a. the star's temperature


b. the star's radius


c. the star's mass


d. the star's color


e. the type of fusion in the star

Astronomy homework questions. Please help!!!!!?
Wow, I love tests.


1. d. Heat from condensation powers a protostar, fusion later.


2. a. Not too sure, though. The core does get hotter, but the outer layers expand and get cooler.


3. e. Degeneracy in the core prevents further collapse, but increases temperature to the point where helium ignites.


4. c. A star's mass is the main factor. Heavier elements can also effect some properties, but to a lesser degree.
Reply:1 d. Gravitational collapse. This process continues for roughly a million years with stars of 1 solar mass, before fusion begins.





2. e. The star expands and liberates more energy.





3. e. http://en.wikipedia.org/wiki/Helium_flas...





4. c.


Please help multiple choice. Thanks?

1. Which of the following statements describes the process of anaerobic glycolysis?





A. The body breaks down ATP and PC to create energy.


B. The body uses oxygen to form new stores of ATP.





C. The body partially breaks down glucose to produce energy (ATP) and the by-product lactic acid.





D. The body breaks down oxygen and glycogen to produce energy.














2. A contraction that causes a muscle to lengthen rather than shorten is called





A. eccentric.


B. isotonic.





C. static.





D. isokinetic.














3. Which of the following statements concerning energy production is true?





A. Energy is produced only in the cardiovascular system.


B. The body breaks down adenosine triphosphate (ATP) to create energy.





C. The body uses chemical reactions to break foods down into METS.





D. The only way the body can produce energy is by using oxygen.














4. Which of the following sports uses Energy System 3 to supply ATP to the body?





A. Weight lifting


B. Gymnastics





C. Swimming





D. Wrestling














5. The basic unit that describes energy costs in terms of oxygen consumption is the





A. MET.


B. kcal.





C. ATP.





D. ADP.

Please help multiple choice. Thanks?
ummmm, cbdac :o)
Reply:can u plz post this at http://www.tutorbuddy.org i will answer when u post


Choose the best option?

1. Which of the following is not allowed in a brainstorming session?


A. Clear definition of the problem


B. Criticism of poor ideas


C. Large number of alternatives


D. Recording of all alternatives


2. Mr. A is the HR Manager of XYZ Company. He decided to terminate a group of


employees because their positions were no longer necessary in the organization.


What will you say Mr. A has decided for?


A. Restructuring


B. Turnover


C. Downsizing


D. Job Rotation


3. A job has high -------------- if workers are given substantial freedom,


independence, and discretion in scheduling the work and determining the


procedures to be used in carrying it out.


A. Autonomy


B. Feed back


C. Skill Variety


D. Enlargement


4. A ------------- Structure is well suited to organizations which have a single or


dominant core product because each subunit becomes extremely adept at


performing its particular portion of the process.


A. Divisional


B. Functional


C. Matrix


D. Both A and B


5. Which of the following has not contributed to the boundaryless organization?


A. Changes in technology


B. Complex and dynamic environments


C. Static environments


D. Increases in telecommunication


6. Managers will often not choose the decision alternative that rational decision


making indicates to be best because they have a “vague feeling” that another


alternative will be better. Which of the behavioral factors that influence decisionmaking


does this behavior reflect?


A. Bounded rationality


B. Escalation of commitment


C. Intuition


D. Satisficing


7. ------------ means that the two merging companies became history and a new firm


is established


A. Acquisition


B. Merger


C. Joint Venture


D. Both A and B


8. ------------- means only one company became history which is the acquired


company while the acquiring company remain.


A. Joint Venture


B. Merger


C. Acquisition


D. Both A and B


9. A ------------- takes as input an object or situation described by a set of properties,


and outputs a yes/no decision.


A. Decision Criteria


B. Decision Making Process


C. Decision Tree


D. None of the given options


10. Maslow's hierarchy of needs proposes that an individual begins by satisfying ------


----- needs.


A. Self-actualization


B. Esteem


C. Physiological


D. Safety

Choose the best option?
1. B


2. C


3. A


4. B


5. C


6. C


7. B


8. C


9. C


10. C
Reply:1b


2a


3a


4b (guess)


5c


6a or c, guess a


7b


8c


9? guess c


10c

florist delivery

I am learning java application ..without giving exception my prg is giving error..i want to know some thing?

package javaexception;


class App {


public static void main(String args[]) {


a();


}


static void a() {


b();


}


static void b() {


c();


}


static void c() {


d();


}


static void d() {


int i = 1;


int j = 0;


System.out.println(i / j);


}


}


is my program...


java.lang.ArithmeticException: / by zero





at javaexception.App.d(App.java:36)





at javaexception.App.c(App.java:29)





at javaexception.App.b(App.java:24)





at javaexception.App.a(App.java:18)





at javaexception.App.main(App.java:13)


is the exception error...


what is my doubt is ..


App is my program name,,


(App.java:29)





(App.java:24)





(App.java:18)





(App.java:13)


what does the numbers 18,13 etc means

I am learning java application ..without giving exception my prg is giving error..i want to know some thing?
may be the line numbers of your coding
Reply:Firstly, I hope you understand the error was given because you are dividing a number, 1 in this case, by 0. This will always an exception.





Secondly, the numbers that are given out is a dump of the stack.





The stack basically holds the path that was taken to get to the exception, then when the exception happens, it produces what is called a stack trace.





You can trace the exception back through this stack to find out where the exception was called from in your program, etc. I hope that did not confuse you.





Basically, you stack trace reads as such,





The exception called ArithmeticException is thrown at line 36 of your App program.





Line 29 called the method the method that threw the exception, I presume it is the line the says 'd();'





Line 24 called the 'c' method, 'c();'.





Line 18 called the 'b' method, 'b();'.





Line 13 called the 'a' method, 'a();'.








Therefore, you can see the program worked correctly,





main called a, a called b, b called c, c called d, d threw the exception.
Reply:siscuss @ http://www.studyjava.org
Reply:It means exception raised at 29 (i/j)... here u r not handling exceptions so its thrown to its caller functiion (c())... 24 is line no of d(); in c() function.


like 18 and 13 are c(); and b();.........


Electricity questions?

Help! I'm a teacher and I can't find my answer key, and I can't remember all of the questions answers. Can someone please help?





1). A simple complete circuit must have wires connected to a(n)_________.


a. switch


b.switch and conductor


c.source of electrons


d.source of electrons and conductor


2). A battery produces current electricity from_______.


a.mechanical energy


b.static energy


c.chemical energy


d.strong nuclear force


3).When you walk across a carpeted floor and then touch a metal doorkno, the "shock" you may feel occurs because of a(n)__________.


a.static discarge


b.electric field


c.static charge


d.chemical reaction


4).A measure of the potential energy available in a complete circuit is________.


a.current


b.power


c.resistance


d.voltage


5).Dry skin is a good_______. a.conductor b.insulator c. source of negative charges d. voltage


6).The negative terminal of a battery has ____________.


a.a pileup of positive charges


b.a positive charge


c.a pileup of

Electricity questions?
1) c


2) c


3) a


4) d


5) a


6) c


7) b


8) a


9) This one could have two answers. Conventionally, current is said to flow from the positive terminal to the negative one. However, we now know that current flows in the opposite direction. In most scenarios, the conventional model is generally used to describe current flow.


10) Ohms


11)The electric current will cause a person's muscles to contract, thus forcing him to grasp the wire. (Although this is rare.)
Reply:?????


Please help me?

i just need help with these 8 questions i did the other like 42





1. A current that flows in one direction is called





A. series


B. direct


C. alternating


D. generator


2. The unit used in measuring resistance in electrical circuits





A. Ohm


B. ampere


C. volt


D. conductor


3. Type of current where electrons flow in a steady stream





A. alternating


B. electric


C. chemical


D. grounding


4. Wire that is easily melted when the electrical current becomes too strong.





A. static


B. electrical


C. fuse


D. resistor


5. In our homes, this type of current is used





A. direct


B. alternating


C. static


D. generator


6. Unit used in measuring resistance in electrical currents





A. ampere


B. volt


C. ohm


7. What causes static electricity?





A. too many protons


B. too many electrons stick


C. materials are overly charged


8. Materials that discourage the flow of electricity is a(n)





A. insulator


B. wire


C. generator


D. current

Please help me?
A


C


B


D


C


B


B


D








alot





but not 100%
Reply:BABCBCCA





1) DC stands for direct current. An example is a battery with a positive and negative terminal. Household electricity is AC which stands for alternating current.





2) The units of resistance are Ohms. Volts are units of electric potential, Amperes are units of current, and "conductor" isn't an electrical unit.





3) Electrical current is the type of current that is a flow of electrons, it can be either alternating or direct.





4) A wire that melts in excessive electrical current is a fuse, when the wire melts it breaks the circuit. This is intended to protect the circuit from damage.





5) As I said before, homes use AC which stands for alternating current. Edison originally was a propoent of direct current, but alternating current becamse the standard because it could be transmitted more efficiently over long distances.





6) Units of resistance are Ohms, it seems strange that this question is repeated.





7) Static electricity is when a material builds up a charge, the charge can be positive (fewer electrons than protons) or negative (more electrons than protons). Static discharge occurs when there is sufficient charge built up to cause the electrons to jump from a negatively charged material to a positively or less negatively charged material.





8) Insulators are poor conductors of electricity. Wires are made from materials that are good conductors of electricity, usually a metal such as copper. Generators convert mechanical energy into electrical energy, generally by moving a conductor through a magnetic field.
Reply:1. A current that flows in one direction is called


B. direct current or DC


(see question 3)





2. The unit used in measuring resistance in electrical circuits


A. Ohm





3. Type of current where electrons flow in a steady stream


None of these. DC is the answer





4. Wire that is easily melted when the electrical current becomes too strong.


C. fuse





5. In our homes, this type of current is used


B. alternating





6. Unit used in measuring resistance in electrical currents


should be "Unit used in measuring resistance in electrical circuits"


C. ohm





7. What causes static electricity?


None of these. electrons are dislodged by physical actions, ie, by rubbing.





8. Materials that discourage the flow of electricity is a(n)


A. insulator


I need help on these siece questions?

can u plz help me with these questions?





1 . Electric charge that has built up in one place is called what kind of electricity?





A. current


B. circuit


C. static


D. current circuit





2 . Static discharge differs from an electric current in that a static discharge





A. is a flow of electrons.


B. lasts for only a fraction of a second.


C. involves the movement of ions as well as electrons.


D. results because a force is exerted on the electrons.





3 . Which of the following describes lightning?





A. a very large discharge of static electricity


B. a high voltage electric current


C. a build up of neutrons


D. harmless





4 . A circuit that has two or more separate paths for electrons to follow is a





A. parallel circuit.


B. series circuit.


C. circuit diagram.


D. electron circuit.





5 . Which is a path created for a current that allows only one route of travel?





A. series current


B. parallel current


C. parallel circuit


D. series circuit





6 . A material through which electrons do not readily flow is a(n)





A. transformer.


B. insulator.


C. conductor.


D. fuse.





7 . Resistance is measured using which unit?





A. volts


B. ohms


C. coulombs


D. amperes





8 . Which scientist discovered that "current is equal to the potential difference divided by the resistance"?





A. Ohm


B. Newton


C. Faraday


D. Watt





9 . A television that requires .40 ampere of current is operated on a 120-volt service for 5 hours. How much energy is used?





A. .67 kWh


B. .15 kWh


C. .24 kWh


D. 1.5 kWh





10 . Which of these contains a source of constant electric current?





A. switch


B. transformer


C. dry cell


D. wire





11 . Where is the location of the strongest magnetic forces in a magnet?





A. atoms


B. magnetic fields


C. magnetic poles


D. magnetic domains





12 . What is the region around a magnet where the magnetic forces are acting?





A. magnetic field


B. magnetic poles


C. ammeters


D. domains





13 . Which of the following describes the atoms in a magnet?





A. They are positively charged.


B. They are negatively charged.


C. They are lined up according to their charges.


D. They are arranged randomly.





14 . The function of a generator is to change





A. electrical energy to mechanical energy.


B. chemical energy to electrical energy.


C. mechanical energy to electrical energy.


D. electrical energy to chemical energy.





15 . What is a transformer called that increases voltage?





A. step-up transformer


B. resistance transformer


C. step-down transformer


D. voltage motor





16 . Current that does not reverse direction is called





A. direct current.


B. circuit current.


C. magnetic current.


D. alternating current.





17 . The function of an electric motor is to change





A. electrical energy to chemical energy.


B. mechanical energy to chemical energy.


C. chemical energy to electrical energy.


D. electrical energy to mechanical energy.





18 . A generator creates a 90-Hz alternating current. How many times does the current reverse each second?





A. 45 times


B. 180 times


C. 90 times


D. 360 times





19 . Which of the following produces direct current or DC?





A. nuclear power plant


B. hydroelectric dam


C. wind turbine


D. 12-volt battery





20 . Which of the following would not change the strength of an electromagnet?





A. increasing the number of loops


B. inserting an iron core inside the wire


C. changing the current's direction


D. increasing the amount of current

I need help on these siece questions?
Can you at least split the assignment into different questions?





1. C
Reply:1 C


2. B


3. A


4. A


5. A


6. B


7. B


8. A


9. D


10. C


11. A


13. C


14. C


15. A


16. A


17. D


18. C


19 D


20. C





and so on


Please read the required material and correct answers will start popping out.
Reply:C


B


A


A


A


B


B


A


D


C


A


C


C


A


A


i think its D....


C


D


C
Reply:answers CBAAABBACAD(NOT KNOW)CBDC
Reply:We are here to help with some concerns that you might have but were not here to do all your homework!!!

wreath

Do anybody know if i can download the complete book "statics and Mechanics of Materials" by R.C. Hibbeler?

the second edition, it is a prentice hall.

Do anybody know if i can download the complete book "statics and Mechanics of Materials" by R.C. Hibbeler?
Download MIRC (www.mirc.com), join the Undernet server, and try the channel #bookz





Most complete source of ebook material, excluding the gutenberg press, that I've found.
Reply:try edonkey or emule





theyve got everything.


Please help me rewrite this poker game C++ code and make it work...?

#include %26lt;iostream%26gt;


#include %26lt;string%26gt;


#include %26lt;time.h%26gt;





using namespace std;





class cCard


{


public:


char face[13] = {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};


enum suit[4] = {"S", "H", "D", "C"};


int getSuit ();


int getFace();


void print();


};


int cCard::getSuit()


{


return suit;


}


int cCard::getFace()


{


return face;


}


void cCard::print()


{


std::cout%26lt;%26lt;face %26lt;%26lt;suit;


}





class cDeck


{


public:


void shuffle();


char Card[13][4];


void Deck;


};


void cDeck::shuffle()


{


int face, suit;


for(face = 2; face %26lt; 13; face++)


{


for(suit = 0; suit %26lt; 4; suit++)


Card[face][suit] = NULL;


}


}


void cDeck::Deck()


{


int card, suit, face;


int deck[deckSuit][deckFace];


card = 1 ;


for (suit = 0 ; suit %26lt;= deckSuit - 1 ; suit++ )


{


for (face = 0 ; face %26lt;= deckFace - 1 ; face++ )


{


deck[suit][face] = card ;


card++;


}


}


}





class cPlayer


{


public:


string cPlayer();


void printHand();


void print();


};


string cPlayer::cPlayer(string name, int stake)


{


playerName = name;


playerStake = stake;


}


void cPlayer::printHand()


{


std::cout%26lt;%26lt;Card%26lt;%26lt;"\tab"%26lt;%26lt;Card%26lt;...


}


void cPlayer::print()


{


cout%26lt;%26lt;name %26lt;%26lt;" $" %26lt;%26lt;stake %26lt;%26lt;"\n";


}





class cGame


{


public:


bool addPlayer();


void play();


void deal();


void cardQuality();


void print();


};


bool cGame::addPlayer(string playerName, int playerStake)


{


std::cout %26lt;%26lt; "Enter your name: ";


std::cin %26gt;%26gt; playerName;


std::cout %26lt;%26lt; "\nHow much money you have for the game? ";


std::cin %26gt;%26gt; playerStake;


}


void cGame::play(int player[][2] , int shuffledCard[][13])


{


int sCard, sSuit, sFace, pSuit = 0 , pFace = 0;


static int cardStart = 1;





for (sCard = cardStart ; sCard %26lt;= cardStart + 4; sCard++ ) {


for (sSuit = 0 ; sSuit %26lt;= 3; sSuit++ ){


for(sFace = 0 ; sFace %26lt;= 12; sFace++ ){


if (shuffledCard[sSuit][sFace] == sCard ){


player[pSuit][pFace] = sSuit;


pFace++;


player[pSuit][pFace] = sFace;


pFace--;


pSuit++;








}


}


}


}


cardStart = sCard;





}


void cGame::deal(int playerHand[][2], const char *suit1[], const char *face1[])


{


int a , b;


for ( a = 0 ; a %26lt;= 4; a++ )


{


b = 0;


std::cout%26lt;%26lt;"%s"%26lt;%26lt;suit1[playerH...


b = 1;


std::cout%26lt;%26lt;"%s "%26lt;%26lt;face1[playerHand[a][b]]);


}


}


void cGame::whatHand( int playerHand [][2] )


{





int x,y;


int positFace[5], positSuit[5];


int *fPtr = positFace, *sPtr = positSuit ;


int Facepass = 0;


int Suitpass = 0 ;


int straight = 0;


for ( x = 0 ; x %26lt;= 4 ; x++ )


{


y = 1 ;


*fPtr = playerHand[x][y];


fPtr++ ;


}


for ( x = 0 ; x %26lt;= 4 ; x++ )


{


y = 0 ;


*sPtr = playerHand[x][y];


sPtr++ ;


}





for ( x = 0 ; x %26lt;= 3 ; x++ )


{


for ( y = (x + 1); y %26lt;= 4 ; y++ )


{


if ( *(positFace + x ) == *(positFace + y ) )


{


Facepass++;


}


}


}


for ( y = 0 ; y %26lt;= 3 ; y++ )


{


for (x = 0 ; x %26lt;= 3 ; x++ )


{


if ( positFace[x] %26gt; positFace[x+1] )


{


Swap(%26amp;positFace[x],%26amp;positFace[...


}


}


}


for ( y = 0; y %26lt;= 3 ; y++ )


{


if ( positFace[y] == positFace[y + 1] - 1 )


{


straight++;


}


}


for ( y = 1; y %26lt;= 4 ; y++ )


{


if ( *positSuit == *(positSuit + y ) )


{


Suitpass++;


}


}


switch ( Facepass )


{


case 1 :


std::cout%26lt;%26lt;"This poker hand contains a pair\n";


break ;


case 2 :


std::cout%26lt;%26lt;"This poker hand contains two pairs\n";


break;


case 3 :


std::cout%26lt;%26lt;"This poker hand contains three of a kind\n";


break ;


case 4:


std::cout%26lt;%26lt;"This poker hand contains a full house\n";


break ;


case 6:


std::cout%26lt;%26lt;"This poker hand contains four of a kind\n";


break ;


default :


if ( Suitpass == 4 %26amp;%26amp; straight != 4)


{


std::cout%26lt;%26lt;"This poker hand contains a flush\n";





}


if ( straight == 4 %26amp;%26amp; Suitpass != 4)


{


std::cout%26lt;%26lt;"This poker hand contains a straight\n";


}


if ( straight == 4 %26amp;%26amp; Suitpass == 4)


{


std::cout%26lt;%26lt;"This poker hand contains a straight flush\n";


}


break;


}


}





int main()


{


cPlayer thisplayer(Play#1, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#1, deck);


deal(Play#1, suit, face);


whatHand(Play#1);


cPlayer thisplayer(Play#2, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#2, deck);


deal(Play#2, suit, face);


whatHand(Play#2);


cPlayer thisplayer(Play#3, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#3, deck);


deal(Play#3, suit, face);


whatHand(Play#3);


addPlayer thisplayer();


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(playerName, deck);


deal(playerName, suit, face);


whatHand(playerName);


return 0;


}

Please help me rewrite this poker game C++ code and make it work...?
Sorry dude no time.
Reply:what error did your compiler give you?


Can somebody explain to me that simple C# loop plz?

using System;





class UseDecimal {


public static void Main() {


decimal price;


decimal discount;


decimal discounted_price;





// compute discounted price


price = 19.95m;


discount = 0.15m; // discount rate is 15%





discounted_price = price - ( price * discount);





Console.WriteLine("Discounted price: $" + discounted_price);


}


}


The output from this program is shown here:





Discounted price: $16.9575








Sorry I am trying to find out how do we get $16.9575??


Thanks for explaining into details. I am learning C# and I have trouble to understand the for loop for some reason!1 I understand other loops but the (FOR) loop gives me issues.

Can somebody explain to me that simple C# loop plz?
it's self explantory if you look at the line





// compute discounted price


price = 19.95m;


discount = 0.15m; // discount rate is 15%





discounted_price = price - ( price * discount);





It sounds like to me you are having a mental block at the moment.





The best thing to do is to just take a breather away from what you are frustrated over and come back to it later. Sometimes it ends up clicking when you do that.





Also, when learning something new, try not to let your brain make it more complicated that it is. Are you taking classes or are you just reading books?


Can somebody please help me with this C++ code?

#include %26lt;iostream%26gt;


#include %26lt;string%26gt;


#include %26lt;time.h%26gt;





using namespace std;





class cCard


{


public:


char face[13] = {'2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A'};


enum suit[4] = {"S", "H", "D", "C"};


int getSuit ();


int getFace();


void print();


};


int cCard::getSuit()


{


return suit;


}


int cCard::getFace()


{


return face;


}


void cCard::print()


{


std::cout%26lt;%26lt;face %26lt;%26lt;suit;


}





class cDeck


{


public:


void shuffle();


char Card[13][4];


void Deck;


};


void cDeck::shuffle()


{


int face, suit;


for(face = 2; face %26lt; 13; face++)


{


for(suit = 0; suit %26lt; 4; suit++)


Card[face][suit] = NULL;


}


}


void cDeck::Deck()


{


int card, suit, face;


int deck[deckSuit][deckFace];


card = 1 ;


for (suit = 0 ; suit %26lt;= deckSuit - 1 ; suit++ )


{


for (face = 0 ; face %26lt;= deckFace - 1 ; face++ )


{


deck[suit][face] = card ;


card++;


}


}


}





class cPlayer


{


public:


string cPlayer();


void printHand();


void print();


};


string cPlayer::cPlayer(string name, int stake)


{


playerName = name;


playerStake = stake;


}


void cPlayer::printHand()


{


std::cout%26lt;%26lt;Card%26lt;%26lt;"\tab"%26lt;%26lt;Card%26lt;%26lt;"\tab"%26lt;%26lt;C...


}


void cPlayer::print()


{


cout%26lt;%26lt;name %26lt;%26lt;" $" %26lt;%26lt;stake %26lt;%26lt;"\n";


}





class cGame


{


public:


bool addPlayer();


void play();


void deal();


void cardQuality();


void print();


};


bool cGame::addPlayer(string playerName, int playerStake)


{


std::cout %26lt;%26lt; "Enter your name: ";


std::cin %26gt;%26gt; playerName;


std::cout %26lt;%26lt; "\nHow much money you have for the game? ";


std::cin %26gt;%26gt; playerStake;


}


void cGame::play(int player[][2] , int shuffledCard[][13])


{


int sCard, sSuit, sFace, pSuit = 0 , pFace = 0;


static int cardStart = 1;





for (sCard = cardStart ; sCard %26lt;= cardStart + 4; sCard++ ) {


for (sSuit = 0 ; sSuit %26lt;= 3; sSuit++ ){


for(sFace = 0 ; sFace %26lt;= 12; sFace++ ){


if (shuffledCard[sSuit][sFace] == sCard ){


player[pSuit][pFace] = sSuit;


pFace++;


player[pSuit][pFace] = sFace;


pFace--;


pSuit++;








}


}


}


}


cardStart = sCard;





}


void cGame::deal(int playerHand[][2], const char *suit1[], const char *face1[])


{


int a , b;


for ( a = 0 ; a %26lt;= 4; a++ )


{


b = 0;


std::cout%26lt;%26lt;"%s"%26lt;%26lt;suit1[playerHand[a][b]]...


b = 1;


std::cout%26lt;%26lt;"%s "%26lt;%26lt;face1[playerHand[a][b]]);


}


}


void cGame::whatHand( int playerHand [][2] )


{





int x,y;


int positFace[5], positSuit[5];


int *fPtr = positFace, *sPtr = positSuit ;


int Facepass = 0;


int Suitpass = 0 ;


int straight = 0;


for ( x = 0 ; x %26lt;= 4 ; x++ )


{


y = 1 ;


*fPtr = playerHand[x][y];


fPtr++ ;


}


for ( x = 0 ; x %26lt;= 4 ; x++ )


{


y = 0 ;


*sPtr = playerHand[x][y];


sPtr++ ;


}





for ( x = 0 ; x %26lt;= 3 ; x++ )


{


for ( y = (x + 1); y %26lt;= 4 ; y++ )


{


if ( *(positFace + x ) == *(positFace + y ) )


{


Facepass++;


}


}


}


for ( y = 0 ; y %26lt;= 3 ; y++ )


{


for (x = 0 ; x %26lt;= 3 ; x++ )


{


if ( positFace[x] %26gt; positFace[x+1] )


{


Swap(%26amp;positFace[x],%26amp;positFace[x+1]);


}


}


}


for ( y = 0; y %26lt;= 3 ; y++ )


{


if ( positFace[y] == positFace[y + 1] - 1 )


{


straight++;


}


}


for ( y = 1; y %26lt;= 4 ; y++ )


{


if ( *positSuit == *(positSuit + y ) )


{


Suitpass++;


}


}


switch ( Facepass )


{


case 1 :


std::cout%26lt;%26lt;"This poker hand contains a pair\n";


break ;


case 2 :


std::cout%26lt;%26lt;"This poker hand contains two pairs\n";


break;


case 3 :


std::cout%26lt;%26lt;"This poker hand contains three of a kind\n";


break ;


case 4:


std::cout%26lt;%26lt;"This poker hand contains a full house\n";


break ;


case 6:


std::cout%26lt;%26lt;"This poker hand contains four of a kind\n";


break ;


default :


if ( Suitpass == 4 %26amp;%26amp; straight != 4)


{


std::cout%26lt;%26lt;"This poker hand contains a flush\n";





}


if ( straight == 4 %26amp;%26amp; Suitpass != 4)


{


std::cout%26lt;%26lt;"This poker hand contains a straight\n";


}


if ( straight == 4 %26amp;%26amp; Suitpass == 4)


{


std::cout%26lt;%26lt;"This poker hand contains a straight flush\n";


}


break;


}


}





int main()


{


cPlayer thisplayer(Play#1, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#1, deck);


deal(Play#1, suit, face);


whatHand(Play#1);


cPlayer thisplayer(Play#2, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#2, deck);


deal(Play#2, suit, face);


whatHand(Play#2);


cPlayer thisplayer(Play#3, 1000);


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(Play#3, deck);


deal(Play#3, suit, face);


whatHand(Play#3);


addPlayer thisplayer();


thisplayer.print();


deck[4][13];


shuffle(deck, deckFace, deckSuit);


play(playerName, deck);


deal(playerName, suit, face);


whatHand(playerName);


return 0;


}

Can somebody please help me with this C++ code?
this is one issue


enum suit[4] = {"S", "H", "D", "C"}; %26lt;---not an int


int cCard::getSuit()


{


return suit; %26lt;--returning an int


}


******


additional


looked further down realized your next one also returned an int when what you had was a char
Reply:what's the problem?

balsam

Creating assemblies for C# Console app.?

I'm a C# newbie, without any previous knowledge/experience in programming.


So I've been trying my hand at a few console apps at the moment.


I created five programs, viz. Prime numbers.cs, array_manipulation.cs, calculator.cs, factorial.cs, and Fibonacci.cs





All these files have the same namespace "Ritz".


Moreover, they are part of the same project and each of them has their own static Main function.





Now what I wanna do is create a WinForm,and place buttons on the form to launch these console apps.





Please help me out with this, I am a newbie, but obedient, and will get the hang of any sort of jargon you wanna use........





I'll post the source codes if that would help you to help me......





Thanks,


Ritz

Creating assemblies for C# Console app.?
Somewhere under Project Properties you can change your application type to a Windows Application, instead of a Console Application.





I really recommend you just create a new Windows Application project, usually a file called Program.cs is created with a special Main() function preconfigured to launch a window.





You can use the Process.Start() command to trigger your console apps to run as other processes.


Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.


Create two classes: Purchased_item, Bill


The Purchased_item should be having the following data members





" item_num //for item number





note: item_num //should be static. This data member will be used to display the item number whose information is currently required from the user





" price //for per unit price


" quantity //for quantity purchased





class Bill should have two data members





" total_amount //for the total amount of bill that is to be paid


" items[5] //an array of purchased_item; should be 5 in size





class Bill should also have a member function that is used to calculate the total amount and assign it to the data member , total_amount


Your program should take input of the price and quantity of 5 items and display the total amount after calculation.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.
its ur home work baby........so try do it by urself.


How can I run an exe file by C# Windows programming?

How can I run an exe file by C# Windows programming? I have problems in running an exe file by clicking the button that i made in c# windows programing, can anyone of you write the code of event handler in c# through which i can run exe file by just clicking the button,rest of the code is:


using System;


using System.Windows.Forms;


using System.Drawing;


class ButtonForm : Form {


Button MyButton = new Button();


public ButtonForm() {


Text = "Respond to a Button";


MyButton = new Button();


MyButton.Text = "Press Here";


MyButton.Location = new Point(100, 200);


// Add button event handler to list.


MyButton.Click += new EventHandler(MyButtonClick);


Controls.Add(MyButton);


}


[STAThread]


public static void Main() {


ButtonForm skel = new ButtonForm();


Application.Run(skel);


}


// Handler for MyButton.


{ Please guide me with this part.


}


}


Thank u in advance.

How can I run an exe file by C# Windows programming?
Okay, you already have a function defined, you need to go to your Form.cs file, where the EventHandler is located.





MyButton.Click += new EventHandler(MyButtonClick);





This points to the MyButtonClick function.





**************************************...


Now you need to add:





using System.Diagnostics;








Then create a process:


Process TheProcessYouNamed;





private void MyButtonClick(object sender, EventArgs e)


{


TheProcessYouNamed = Process.Start("EXEToRun.exe");








TheProcessYouNamed.CloseMainWindow();


}


Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.


Create two classes: Purchased_item, Bill


The Purchased_item should be having the following data members





" item_num //for item number





note: item_num //should be static. This data member will be used to display the item number whose information is currently required from the user





" price //for per unit price


" quantity //for quantity purchased





class Bill should have two data members





" total_amount //for the total amount of bill that is to be paid


" items[5] //an array of purchased_item; should be 5 in size





class Bill should also have a member function that is used to calculate the total amount and assign it to the data member , total_amount


Your program should take input of the price and quantity of 5 items and display the total amount after calculation.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.
Have you tried to create this program yourself? Can you give it a try then ask questions? This is not a very small program and in addition to that if we just give you the answer you will never learn how to do something like this in the future by yourself.





What don't you know how to do? Is it what classes or structs you need to create %26amp; how? Is it how to read and store data? Is it how to create member functions of classes? Is it how to display data?





Please, answer these questions in the additional details section so I can help you.

wisteria

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.


Create two classes: Purchased_item, Bill


The Purchased_item should be having the following data members





" item_num //for item number





note: item_num //should be static. This data member will be used to display the item number whose information is currently required from the user





" price //for per unit price


" quantity //for quantity purchased





class Bill should have two data members





" total_amount //for the total amount of bill that is to be paid


" items[5] //an array of purchased_item; should be 5 in size





class Bill should also have a member function that is used to calculate the total amount and assign it to the data member , total_amount


Your program should take input of the price and quantity of 5 items and display the total amount after calculation.

Write a C++ program that will find out the total amount of a customer's bill according to the items purchased.
the logic is perfect go on with you programming skill


try out then ask for troubles
Reply:You can get some help from


http://expert.timecapsuleyahoo.com/


How do I fix this problem in C++?

I need to know how to properly use the SetTimer() function in C++ from windows.h.. Please helm me about this... I have this code, but it doesn't seem to have any result...





#include %26lt;windows.h%26gt;


#include %26lt;iostream%26gt;


#include %26lt;conio.h%26gt;





using namespace std;





HANDLE curhndl();





int i = 0;


void proc();





main()


{


void (*fptr)() = %26amp;proc;


SetTimer((HWND)curhndl(), 1, 1, fptr());


getch();


cout%26lt;%26lt;i;


getch();


}





void proc()


{


i++;


}





HANDLE curhndl()


{


static bool called;


static HANDLE hwnd;


if (called != true){


hwnd = GetStdHandle(STD_OUTPUT_HANDLE);


if (hwnd == INVALID_HANDLE_VALUE){ return INVALID_HANDLE_VALUE; }


called = true; }


return hwnd;


}

How do I fix this problem in C++?
Sorry to say, but your code is ABSOLUTELY incorrect. Sorry again :(





If you want to use API timers, you should spin message loop. The handle (that you pass to SetTimer) should be not the standard output or whatever, but a handle of a real window (that is why it is of HWND type)! If you pass to SetTimer something different from a window handle (even if you cast it to HWND as you smartly did :) ), the function will fail and will not create a timer.





I don't think it is a good idea to use API timers in console application at all - they are not designed to work this way. Try windowed application.
Reply:I think there may be a few problems with the code. One that jumps out at me is in HANDLE curhndl().





You are not initializing 'static bool called', so it starts off as a garbage value (not 0). Since 'true' means 'not-zero', called will likely always be true. That means GetStdHandle never executes.





Hope that helps. Good luck!


PLease provide a short explanation with each answer of my C++ program....?

Assuming Point is a class type with a public copy constructor, iden¬tify each use of the copy constructor in this program fragment:


Point global;


Point foo_bar(Point arg)


{


Point local = arg;


Point *heap = new Point(global);


*heap = local;


Point pa[ 4 ] = { local, *heap };


return *heap;





______________________________...





Exercise 13.10: Define an Employee class that contains the employee's name and a unique employee identifier. Give the class a default constructor and a constructor that takes a string representing the employee's name. If the class needs a copy construc¬tor or assignment operator, implement those functions as well.





______________________________...








Among the fundamental operations a pointer supports are dereference and arrow. We can give our class these operations as follows:


class ScreenPtr { public:


// constructor and copy control members as before


Screen %26amp;operator*() { return *ptr-%26gt;sp; }


Screen *operator-%26gt;() { return ptr-%26gt;sp; }


const Screen %26amp;operator*() const { return *ptr-%26gt;sp; } const Screen *operator-%26gt;() const { return ptr-%26gt;sp; } private:


ScrPtr *ptr; // points to use-counted ScrPtrclass








Exercise 14.20: In our sketch for the ScreenPtr class, we declared but did not define the assignment operator. Implement the ScreenPtr assignment operator.





______________________________...





Exercise 14.21: Define a class that holds a pointer to a ScreenPtr. Define the over¬loaded arrow operator for that class.


______________________________...








Exercise 15.4: A library has different kinds of materials that it lends out—books, CDs, DVDs, and so forth. Each of the different kinds of lending material has different check-in, check-out, and overdue rules. The following class defines a base class that we might use for this application. Identify which functions are likely to be defined as virtual and which, if any, are likely to be common among all lending materials. (Note: we assume that LibMember is a class representing a customer of the library, and Date is a class representing a calendar day of a particular year.)


class Library { public:


bool check_out(const LibMemberk);


bool check_in (const LibMember%26amp;);


bool is_late(const Date%26amp; today);


double apply_fine();


ostream%26amp; print(ostream%26amp; = cout);


Date due_date() const;


Date date_borrowed() const;


string title 0 const;


const LibMember%26amp; member() const;





______________________________...








Exercise 15.8: Given the following classes, explain each print function:


struct base {


string name () { return basenatne; }


virtual void print(ostream %26amp;os) { os « basename; } private:


string basename;


};


struct derived {


void printO { print (ostream %26amp;os) ; os « " " « mem; } private:


int mem;


};





If there is a problem in this code, how would you fix it?





______________________________...








Exercise 15.13: Given the following classes, list all the ways a member function in Cl might access the static members of ConcreteBase. List all the ways an object of type C2 might access those members.


struct ConcreteBase {


static std::size_t object_count(); protected:


static std::size_t obj_count;


};


struct Cl : public ConcreteBase


{ /* . . .*/};


struct C2 : public ConcreteBase


{ /* ...*/};





______________________________...





Exercise 15.25: Assume Derived inherits from Base and that Base defines each of the following functions as virtual. Assuming Derived intends to define its own ver¬sion of the virtual, determine which declarations in Derived are in error and specify what's wrong.


(a)Base* Base::copy(Base*);


Base* Derived::copy(Derived*);


(b)Base* Base::copy(Base*) ;


Derived* Derived::copy(Base*) ;


(c)ostreamk Base::print(int, ostream%26amp;=cout);


ostream%26amp; Derived::print(int, ostream%26amp;);


(d)void Base::eval() const;


void Derived::eval();

PLease provide a short explanation with each answer of my C++ program....?
And what makes you think that people here have enough free time to do your homework, when all you could do was to copy and paste it here?


How to disable "inline" keyword in C??

I am doing unit testing of some C code written in Unix. There is a inline keyword before so many functions in header file.


e.g.





static inline functionname(int arg)


(


// function body


}





I am compiling this code on borland compiler fo unit testing.


above function is called inside function under unittest. How do I remove significance on "inline" in one line from all other functions also.

How to disable "inline" keyword in C??
First of all, inline is not a reserved word in C. It is however a reserved word in C++.





Is the compiler you are using a C compiler or a C++ compiler?





If it is indeed a C++ compiler, you may find the following tutorial to be of use:http://dn.codegear.com/sv/print/23055





On the other hand, if it is a C compiler, more information on the compiler would be helpful.
Reply:I am not sure will it work in Borland compiler, but you can try to redefine "inline" keyword with a preprocessor.


#define inline


will remove all "inline" from your code before the compilation.

anemone

C++ Windows programming: Can't make this program run?

I'm just starting C++ windows programming and I copied this right out of my book (with a couple of adjustments since i needed to refer to different pathways).


This program compiles, but it does not run. When I try to open the icon that ws produced nothing happens. What is wrong with it?


Here's the program





Window.cpp


#include "window.h"





LRESULT CALLBACK WndProc(HWND hWindow, UINT msg, WPARAM wParam, LPARAM lParam);





int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,


PSTR szCmdLine, int iCmdShow)


{


static TCHAR szAppName[] = TEXT("Skeleton");


WNDCLASSEX wndclass;


HWND hWindow;


MSG msg;








wndclass.cbSize = sizeof(wndclass);


wndclass.style = CS_HREDRAW | CS_VREDRAW;


wndclass.lpfnWndProc = WndProc;


wndclass.cbClsExtra = 0;


wndclass.cbWndExtra = 0;


wndclass.hInstance = hInstance;


wndclass.hIcon = LoadIcon(hInstance,


MAKEINTRESOURCE(IDI_WINDOW));

C++ Windows programming: Can't make this program run?
RegisterClassEx() fails and bails out.


RegisterClassEx() fails because not all fields of wndclass are initialized - some contain garbage. It's a typical mistake that programmers make.





Change declaration of wndclass to this:





WNDCLASSEX wndclass = { sizeof(WNDCLASSEX) };
Reply:this itself is not a program, its a class, it will help you when you write a program and you can call the functions within this file.
Reply:General Cucombre ftw! Ai caramba!


C++ help please?

Consider the following function definition:


void defaultParam(int u, int v = 5, double z = 3.2)


{


int a;


u = u + static_cast%26lt;int%26gt;(2 * v + z);


a = u + v * z;


cout %26lt;%26lt; "a = " %26lt;%26lt; a %26lt;%26lt; endl;


}


What is output of the following function calls?


a. defaultParam(6);


b. defaultParam(3, 4);


c. defaultParam(3, 0, 2.8);

C++ help please?
I provided tracing steps so you can understand what is going on.





a: u = 6, v = 5, z = 3.2


u = 6 + int(2 * 5 + 3.2) = 6 + 13 = 19


a = 19 + 5 * 3.2 = 19 + 16 = 35.


"a = 35"


b: u = 3, v = 4, z = 3.2


u = 3 + int(2 * 4 + 3.2) = 3 + 11 = 14


a = 14 + 4 * 3.2 = 14 + 12.8 = (int) 26.8 = 26


"a = 26"


c: u = 3, v = 0, z = 2.8


u = 3 + int(2 * 0 + 2.8) = 3 + int(2.8) = 5


a = 5 + 0 * 2.8 = 5


"a = 5"
Reply:Dude. Why don't you just type it in, compile it, and run it with those arguments??? Do you own homework!
Reply:Plug in the numbers.


With out a call just using what is in the parameters, I get 29.


So, substitute the 6 for the u and do the math


then etc.....
Reply:You may also post your homework question at websites like http://homeworkhelp.co.in/


C# code help?

I am trying to do a brainteaser using C# code. It sould end up looking like this:


*


**


***


****


*****


******


*******


********


*********


its not working (giving me something different please help?











namespace BrainTeaser


{





class HalfDiamond


{





static void Main()


{





for (int i =1; i %26lt; 10; i++)


{





for (int j = 0; j %26lt; 10; j++)


Console.WriteLine("*");


Console.WriteLine();





}








}








}








}

C# code help?
string x;





for(int i = 1; i %26lt; 10; i++) {


x = "";


for(int y = 0; y %26lt; i; y++) {


x += "*";


}


Console.WriteLine(x);


}
Reply:Consider yourself REPORTED. CHEATER!
Reply:change the "j %26lt; 10" to be "j %26lt; i" and change the line Console.WriteLine("*"); to be Console.Write("*"); so you dont get a Enter key happening after each "*" displayed to make the one line...The following writeline will take care of that for each row..
Reply:To output better use:





Console.WriteLine("".PadLeft(i, '*'));





This will eliminate your entire looking structure with a single line.


C++. How to use main() in a class? Is it possible?

Is it possible to use the pure object-oriented programming in C++?





Is it possible to redefine the entry point of a program to a member function?





e.g. the next code will not compile:


#include %26lt;cstdlib%26gt;


#include %26lt;iostream%26gt;





using namespace std;





class MyClass


{


  public:


    static int main(){


      //This is the main function... it should be


      //the entry point


      system("PAUSE");


      return EXIT_SUCCESS;


    }


};

C++. How to use main() in a class? Is it possible?
Good question.





"Is it possible to redefine the entry point of a program to a member function?"


Yes, but it's not quite what you are expecting, and you really don't want to do something like that. A global main() function is required by the standard. In other words, if you wish to write standards compliant code, you should be using a global main, not a custom entry point. But to explain:





main() is not the entry point. Actually, a function called mainCRTStartup is. You're asking yourself now, I've never written a mainCRTStartup, and that's correct. It's part of the code supplied with the compiler. One part of the code is mainCRTStartup, which is the entry point. mainCRTStartup, among other things, calls main(). Don't believe me? Use the linker options to leave out the default libs; for VC++ it's /NODEFAULTLIB and for gcc linker it is -nodefaultlibs -nostdlib. You'll be forced to write mainCRTStartup yourself.





Now, technically you could change the entry point to MyClass::main()., but then you would have to reimplement the code in mainCRTStartup yourself. For what point?





"e.g. the next code will not compile:"


Just to nitpick, technically the code will compile, but it won't link to an executable, since you need the appropriate entry points defined in some linked in binary.





Aside, to correct answerer "the chip": "C++ isn't object-oriented, it's procedure-driven. The two programming concepts don't really mix."


C++ is object oriented. It has some very powerful generic programming syntax not present in other languages. Feel free to read Modern C++ Design http://www.amazon.com/Modern-C%2B%2B-Des... before complaining about C++ not being OO. Also, object-oriented and procedural programming mix just fine. Any reason they don't?
Reply:No, you can't do that in C++. It always looks for a global main function.
Reply:i dont think its possible to put main( ) inside any declared class.The main( ) fct is a fct declared inside the iostream library of c++, and u cannot use it inside any class,but it is used apart
Reply:C++ isn't object-oriented, it's procedure-driven. The two programming concepts don't really mix. If you want to do object oriented programming you need something like java.

cyclamen

C++ and Libraries(DLL's)?

http://www.learncpp.com/cpp-tutorial/a1-...


I need a tutorial such as this but much more in depth with examples on more than one. I have learned C++ syntax already.

C++ and Libraries(DLL's)?
depending on your compiler, it can be a manual process or not, if you're using Borland Builder or MSVS there should be a dll wizard otherwise you'll have to write it manually.





MSVC - http://logix4u.net/Programming/vc++/A_Tu...





Borland Builder - Look at the help files





another link http://wiki.tcl.tk/2419





All dll have similar entry points, so seeing enough code shold give you the basic idea


Convert java coding program into c/c++.?

i had written it in java. understand the logic n implement it in C/C++. its better to u also and u can understand the logic also.


import javax.swing.*;


import java.awt.event.*;





class Cal extends JFrame implements ActionListener


{


JPanel p;


JLabel da,mo,ye;


JTextField dat,yea,mon;


//JComboBox mon;


JButton get,Exit;


JLabel res;


//String months[] = {"Jan","Feb","Mar","Apr","May"...


int months[] = {31,28,31,30,31,30,31,31,30,31...


int date,month,year,stdate = 1,stmonth = 1,styear = 1,total = 0,tot;


public Cal()


{


p = new JPanel();





da = new JLabel("Enter the date : ");


mo = new JLabel("-");


ye = new JLabel("-");





dat = new JTextField(2);


mon = new JTextField(2);


yea = new JTextField(4);





//mon = new JComboBox(months);





get = new JButton("Obtain");


Exit = new JButton("Exit");





res = new JLabel();





add(p);





p.add(da);


p.add(dat);





p.add(mo);


p.add(mon);





p.add(ye);


p.add(yea);





p.add(get);


p.add(Exit);





p.add(res);





get.addActionListener(this);


Exit.addActionListener(new ExitListener());





setSize(250,100);


setVisible(true);


setDefaultCloseOperation(3);


}


public class ExitListener implements ActionListener


{


public void actionPerformed(ActionEvent ae)


{


System.exit(0);


}


}


public void actionPerformed(ActionEvent ae)


{


total = 0;


date = Integer.parseInt(dat.getText()...


month = Integer.parseInt(mon.getText()...


year = Integer.parseInt(yea.getText()...





int i,ly = 1;





if (ly == leapYear(year) %26amp;%26amp; month %26gt; 2)


{


total += 1;


}





chkerr();





for(i = styear;i %26lt; year;i++)


{


ly = 0;


ly = leapYear(i);


total += 365 + ly;


}





for(i = 1;i %26lt; month;i++)


total += months[i-1];





total += date;





tot = total % 7;


String str = "";


switch(tot)


{


case 1 : str = "Monday";


break;


case 2 : str = "Tuesday";


break;


case 3 : str = "Wednesday";


break;


case 4 : str = "Thursday";


break;


case 5 : str = "Friday";


break;


case 6 : str = "Saturday";


break;


case 0 : str = "Sunday";


break;


}


res.setText(str);


}


public int leapYear(int lyear)


{


if(((lyear%4==0)%26amp;%26amp;(lyear%100!=...


{


return 1;


}


return 0;


}


public void chkerr()


{


String errmsg = "";


int err = 0;





if(date %26lt; 1 || date %26gt; 31)


{


errmsg = "Invalid Date";


err = 1;


}


if(month %26lt; 1 || month %26gt; 12)


{


errmsg = "Invalid Month";


err = 1;


}


if(year %26lt; 1)


{


errmsg = "Invalid Year";


err = 1;


}


if(month == 2)


{


if(leapYear(year) == 1)


{


if(date %26gt; 29)


{


errmsg = "Inavlid Date(For February)";


err = 1;


}


}


else if(date %26gt; 28)


{


errmsg = "Invalid Date(For February)";


err = 1;


}


}


if (err == 1)


{


JOptionPane.showMessageDialog(...


System.exit(0);


}


}


public static void main(String[] args)


{


new Cal();


}


}

Convert java coding program into c/c++.?
I don't understand your question. Are you asking someone to translate it for you, or asking whether it is easier to undertand in C/C++? C/C++ is easy to understand, especially if you leave appropriate comments.
Reply:Before you could convert it to c++ you would need to know what platform you are targetting, that is, MS Windows, UNIX, Linux, Apple, etc.





The reason for this is the different platforms offer different windowing systems. The thing that display the windows you are currently looking at. In the c++ standard, there is no mention of computer graphics, and therefore no standard way of displaying these windows.





Therefore, you would need to know what platform you are targetting, and also if using MS Windows, you need to know what framework you want to use. Some are Win32 API, MFC, OLE, .NET, etc. Then you will better able to know how to build the Graphical User Interface (GUI) like the JFrame, JOptionPane, JLabel, etc.





Converting the other non GUI code should be fairly easy.








P.S. The idea of allowing people to select the month, and then the day and year from a combo box was a very good idea. You should pursue that one.





To select the days to display for the month, you could set up what is called a lookup table. As there are only 4 varieties of days in month, eg 28 feb non leap year, 29 feb leap year, 30 and 31, you only need to 4 instances in this table. Then after finding the index of the combo box item that was selected, use this index to look into the lookup table that holds a link to the instance of 28, 29, 30, or 31 days.





The table could be easily set up as a 4 element array, each entry being another array of the numbers from 1-28, 29, etc. The value to index this table would be 0 for feb in non leap year, 1 for feb in leap year, 2 for 30 days, and 3 for 31 days.





You then update the combo box with the array of items that you just indexed.





Do the same thing for the years, etc, although you would probably need a bigger array for them, eg, 1973-3000 would be require a bigger array than 4 or 31 elements.





This way, you would not have to parse the integers, eg parseInt(...) as you are not checking for an errors, ie, a letter in the text instead of a number, which will produce a number of exceptions.


try


{


Integer.parseInt(dat.getText()...


}


catch (NumberFormatException ex)


{


// Error, a number was not input


// Inform user, reset fields, etc.


}








After looking at your code, I am going to make some changes, so you can remove the GUI stuff from the non GUI stuff, and therefore, hopefully make the transition from Java to c++ easier.








Changes:


(1) Added method checkParam() that does the checking you did in the action performed method.


(1.1) The code in ActionPerformed to reflect above change.


(2) Added the above try - catch clause.


(3) The method 'chkerr()' calls a new method to display the error, so as to seperate the GUI from the other.


(3.1) Updated chkerr() to reflect above, and call the method when an error occurs, instead of waiting until the end of the method to deal with the error. Just semantic changes.





The other thing to remember is that in c++ the 'string' class has a lower case s, not an upper case S like in Java :)





Here is the updated code. Starting with the class ExitListener, the code above that was not changed.





public class ExitListener implements ActionListener


{


public void actionPerformed(ActionEvent ae)


{


System.exit(0);


}


}





public void actionPerformed(ActionEvent ae)


{


total = 0;


try


{


date = Integer.parseInt(dat.getText()...


month = Integer.parseInt(mon.getText()...


year = Integer.parseInt(yea.getText()...


}


catch (NumberFormatException ex)


{


// Inform user of error, reset fields as neccessary, etc.


}





chkParam();


}





public void chparam()


{


int i, ly = 0;





if (ly == leapYear(year) %26amp;%26amp; month %26gt; 2)


{


total += 1;


}





chkerr();





for(i = styear;i %26lt; year;i++)


{


ly = 0;


ly = leapYear(i);


total += 365 + ly;


}





for(i = 1;i %26lt; month;i++)


total += months[i-1];





total += date;





tot = total % 7;


String str = "";


switch(tot)


{


case 1 : str = "Monday";


break;


case 2 : str = "Tuesday";


break;


case 3 : str = "Wednesday";


break;


case 4 : str = "Thursday";


break;


case 5 : str = "Friday";


break;


case 6 : str = "Saturday";


break;


case 0 : str = "Sunday";


break;


}


res.setText(str);


}





public int leapYear(int lyear)


{


if(((lyear%4==0)%26amp;%26amp;(lyear%100!=...


{


return 1;


}


return 0;


}





public void chkerr()


{





if(date %26lt; 1 || date %26gt; 31)


{


showMessage("Invalid Date");


}


if(month %26lt; 1 || month %26gt; 12)


{


showMessage("Invalid Month");


}


if(year %26lt; 1)


{


showMessage("Invalid Year");


}


if(month == 2)


{


if(leapYear(year))


{


if(date %26gt; 29)


{


showMessage("Invalid Date(For February)");


}


}


else if(date %26gt; 28)


{


showMessage("Invalid Date(For February)");


}


}


}





public void showMessage(String msg)


{


JOptionPane.showMessageDialog(...


System.exit(0);


}





public static void main(String[] args)


{


new Cal();


}


}


Function pointer - C++ code section?

I came across following section of code %26amp; it is working with a highly complex system.


Can someone provide some explanation on this like which constructor is being called %26amp; where parameter pCallback is being sent %26amp; what is the meaning of void(*)(void*)%26amp; a::afoo mean?








===================================


a.h


static void afoo ( void * );





a.cc


void a::afoo ( void * pCallback )


--------------------------------------...


file b.h


b ( void );


b (


void (* pStatsUpdate ) ( void * ),


void *


);





file c.cc


new b (


( void


(*) ( void * ) ) %26amp; a::afoo,


this );


===================================

Function pointer - C++ code section?
It does not look sensible to me. The retyped text probably contains some syntax error, For example,





a.h


static voidafoo ( void * );





should be





a.h


static void a::afoo (void*);





or it must be part of a class or namespace declartaion as





class a {


// ...


static void afoo (void*);


//...


};





or





namspace a


{


//...


static void afoo (void*);


//...


};








It is also important to know in which part of the code these declarations and / or defintions take place.





This faily complex structure is either generatated by some auto code generator software, or some programmers that do not like to make their minds clear when they do programming.








The expression void(*)(void*)%26amp; a::afoo means a pointer to any function which returns a void and takes a void * as its only argument such as





void f (void * vp)


{


//...


}





a::afoo class method or namespace function obeys this signature, and therefore, it is qualified to be cast to this type.





I think yet there is another mistype with the %26amp; in this part unless it means a pointer to a pointer to the function (and not the pointer to function itself).
Reply:void(*)(void*)----means a functin pointer, that takes a pointer as parameter and does not have a return value............








the use of %26amp; is the change in function will in turn effect the actual arguements.....





for that paarmeter pCallBack, i think it will return the value to the constructor in a.h, provided you mention its location...


Need help C# do while statement?

i have just wrote all this now I have to use a do while statement loop and so sleepy its due in the morning. Could someone help me figure out a fast way to enter it as a do while?


static void Main()


{ string userin;


char selection=' ';


double beginBalance;


double newBalance;


int numChecks=0;


double checkAmount=0;


double depositAmount=0;


int numDeposits=0;


Console.Write("Please enter the beginning check-book balance: ");


userin = Console.ReadLine();


beginBalance = Convert.ToDouble(userin);


newBalance = beginBalance;


while ((selection != 'q' || selection != 'Q')%26amp;%26amp; newBalance %26gt;0)


{


Console.WriteLine("Please enter the type of transaction you would like to make?");


Console.WriteLine("Transaction codes you must enter are as follows:");


Console.WriteLine("D or d Deposit");


Console.WriteLine("C or c Check");


Console.WriteLine("When you have completed entering the transactions please enter Q or q to quit");


userin = Console.ReadLine();

Need help C# do while statement?
CONSIDER YOURSELF REPORTED AGAIN. I really hope no smart programmer is dumb enough to answer your questions. This is ridiculous!

wedding floral centerpieces

Basic C syntax, assigning a value?

I am working with Borland C++ 5.02 compiling a C program to read an INI file with this function prototype:





extern const double readIniDouble( void *fp, const char *section, const char *name, const double defValue );





I can read the value with no problem with this code:





double test;


test = readIniDouble( iniFile, "ASection", "AName", 2 );


cprintf( "%e", test ); // Correctly writes the default value of '2'





The problem is that I need to get the value into a struct:





static struct settings tmp_set;


tmp_set.aSetting = readIniDouble( iniFile, "ASection", "AName", 2 );


cprintf( "%e", %26amp;tmp_set.aSetting ); // does not work





This compiles but prints an unexpected large number. If I use an ampersand or asterisk in front of tmp_set on the left side of the assignment (%26amp;tmp_set.aSetting = ... ) I get a compiler error 'Illegal use of floating point'.





What is the correct syntax to assign the return value of the iniReadDouble() function directly to the struct member?

Basic C syntax, assigning a value?
don't print %26amp;tmp_set.aSetting, just tmp_set.aSetting. With the %26amp;, you're taking the memory address of that variable, not its value.


Economics Homework Help!: Which of the following is correct about static and dynamic tax analysis models?

a. Static tax analysis indicates that raising the tax rate by 10% will always increase tax revenues by an amount equal to 10% of the tax base


b. According to dynamic tax analysis, there is likely to be a single tax rate that minimizes government tax collections


c. All of the above


d. None of the above

Economics Homework Help!: Which of the following is correct about static and dynamic tax analysis models?
None of the above.


DeVille a/c?

My in-laws Cadillac DeVille a/c stopped working, and low refrigerant-no a/c came up on the message center. I took it to the shop I work for, checked the refrigerant level, and had about 100 psi static pressure. Just to be sure, I reclaimed, evacuated, and recharged the system, still had 100 psi. Jumped the low pressure switch, no change. Un-hooked the battery cable for 5 min, bang, the message disappeared and the a/c started working fine. Anyone have any idea what would cause the eatc to need a reset to begin with? A bad connection at the low pressure switch, or a switch starting to fail, maybe?

DeVille a/c?
Hi, Yes. What year is the car? If it is less than maybe 9 years, or so, the computer controls (everything in some way) I think you did the right thing by unhooking the batt. That resets, and starts from (zero). All you need is a wire thats not hooked, or wet,or dirty, or something to break contact, and you have to start from (zero) again. I still like the Model A Ford (They are east to figger out you know! Hope this helps?
Reply:Could've been anything like the other guy said, a surge in the system, even a hiccup could set it off. If checked all the connections wait and see what happens...