Sunday, August 2, 2009

Please give me short note of my C++ program...?

Problems are taken from C++ Primer book





-Ensure you can complete prior to accepting and emailing me.





-If you do not provide your price to do this I will not respond…





-I require this completed in 1 week.





Exercise 13.3: 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 give me short note of my C++ program...?
And that is a fact since it goes against community guidelines and rules and will be *REPORTED*.
Reply:looks good to me


NEED HELP** my iTunes library lost all of its songs!!!?

my iTunes library lost all of its songs, except the purchased ones! i had about 250 songs. I have a folder C:\Documents and Settings\User\Desktop\Stuff\iTunes Music. All of my current iTunes music is THERE. But when i open iTunes, none of it is there exept purchased ones (only 10 songs). Now if i try to import the lost songs or "add file" it only lets me do a few songs at a time. Is there any way to get what is on my ipod into iTunes??? i will give best answer to the person who gives a straightforward answer that solves this problem. plz i need help, thanks a lot!! any advice is welcome

NEED HELP** my iTunes library lost all of its songs!!!?
I've got four things you could try. One of them is bound to work. Using the "Import" feature is only worth while if you are going to import a couple of songs.





1.


%26gt;First I would try to use the "Consolidate Library" feature located in the upper left hand corner of iTunes under "Advanced." If that doesn't work then you can do it manually by following the instructions in Method 2.





2.


%26gt;Locate the source files (yellow folders) on your hard drive.


%26gt;Then, highlight them and drag and drop them into the iTunes Library interface.





If that was not of any help just follow the steps below to extract the music from your iPod:





Transferring iTunes Music:





3.


To download specific songs you must download third party software (for free). You could download Senuti from http://www.download.com/3000-2182_4-1072...





4.


This method can only be used to transfer ALL songs from the iPod to the computer. It seems like a lot of steps but it will only take you a couple of minutes and you won't need third party software (and is especially convenient if you ever use a computer that is not online.)





%26gt;Connect iPod to computer.


%26gt;”Start.”


%26gt;”My Computer.”


%26gt;Double Click iPod icon.


%26gt;”Tools.”


%26gt;”Folder Options.”


%26gt;”View.”


%26gt;Select “Show Hidden Files %26amp; Folders” and click “OK.”


%26gt;Right click “iPod Control” folder.


%26gt;Select “Properties.”


%26gt;Unselect “Hidden” and click “OK.”


%26gt;A window will pop up. Select “Apply changes to this folder, subfolder and files” and click “OK.”


%26gt;Double click “iPod Control" folder.


%26gt;Double click “Music" folder.


%26gt;You will notice folders labeled “F00, F01, F02, F03, F04, etc.”


%26gt;Open up iTunes side by side with this window. Make sure that the “Music Library” is displayed.


%26gt;In iTunes select “Edit%26gt;Preferences%26gt;Advanced%26gt;and make sure that ‘Keep iTunes Music Folder Organized’ and ‘Copy files to iTunes Music folder when adding to Library’ are checked and click ‘OK.’” You should also make sure that your iPod/iTunes is set to “Manually Manage Songs” so that you have control over what you want to add or delete (to do this select the iPod icon under “Devices” on the left column of the screen and select “Manually Manage Music” under “Options.”).


%26gt;Drag all of the yellow folders (not the Read Me files) directly into iTunes “Music Library.” I’m talking about the part that has song name, artist, track number, etc.


%26gt;You will notice a progress bar indicating that the music is being transferred. Sometimes a message will pop up saying that a song is not compatible with iTunes and that it needs to convert it. Just click “OK” when this message appears.


%26gt;Note: If you have slower computer you may want to only drag a few folders at a time so that your computer doesn’t freeze up.
Reply:Awesome!!!! My hard drive died a few days ago, and I was able to get all of my 6,000 songs back onto my computer using the fourth option. You rock TM!!! Thanks so much! Report It


peony

C++ c language?

Assume that you are required to enter a list of strings into a computer, rearrange them


in alphabetical order, and then print out the rearranged list. The strings must be stored


in a two-dimensional character array. Each string will be stored in a separate row


within the array. You may use any suitable string manipulation functions. One of the


library functions that can be used is strcmpi.


strcmpi compares the strings but does not differentiates between upper and


lowercase characters. The function accepts two strings as arguments and returns


integer value, depending on the relative order of the two strings, as follows:


a) A negative value is returned if the first string alphabetically precedes the second


string.


b) A value of zero is returned if the first string and the second string are identical.


c) A positive value is returned if the second string alphabetically precedes the first


string.


If the function strcmpi (string1, string2) returns a positive value then, this


indicates that string2 must be placed ahead of string1 in order to rearrange the


two strings in alphabetical order.


6


Sample output is given as follows:


Enter each string on a different line:


Type ‘END’ when finished


String 1: Panda


String 2: Apple


String 3: Island


String 4: Calendar


String 5: Brown


String 6: Black


String 7: Rainbow


String 8: News


String 9: Ballroom


String 10: Canada


String 11: END


Reordered list of strings:


String 1: Apple


String 2: Ballroom


String 3: Black


String 4: Brown


String 5: Calendar


String 6: Canada


String 7: Island


String 8: News


String 9: Panda


String 10: Rainbow


String 11: END

C++ c language?
Is this just to make someone else do your computer science homework? Never going to become a programmer like that.





Anyway, you should do the following:


1. Assign a second array with the "values" of the words (perhaps a float to store multiple letters)


2. Sort the second array, mirroring your actions on the original. Use quicksort if you can.


3. Say "w00t!"
Reply:What is your question?


Simple C++ question?

i am trying an example from a book and i cant quite get it yet. hope you can help me.





Question: DECLARE A CHARACTER ARRAY, AND INITIALIZE IT TO A SUITABLE STRING. USE A LOOP TO CHANGE EVERY OTHER CHARACTER TO UPPERCASE. (HINT: ASCII UPPERCASE COUNTER PARTS ARE 32 LESS THEN THERE LOWERCASE )





so i have to use this arithmetic way no. no built in function in a library.





this is what i have so and cant figure out.





#include %26lt;iostream%26gt;





using namespace std;





int main()


{


char c[] = "hello world!";





int count = 0;





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


{


count++;


c[i] = i - 32;


cout %26lt;%26lt; c[i];


}


//cout %26lt;%26lt; c;








return 0;


}





i thought i have everything right except the cout %26lt;%26lt; part however you do it.





any help or suggestions..thanks

Simple C++ question?
first of all,you have wrongly declared the counter variable count.


The loop will exit after one pass. Also, it should be c[i]-=32; or


c[i]=c[i]-32;





try this code instead of the for loop


i=0;


while(c[i]!='\0')


{


c[i]-=32;


i++;


}
Reply:The answers above is somehow incorrect, but some users have suggested good stuff.





I am gonna present you with a solution similar to yours, but I have seen some indexing problems with yours, you have to realize an array starts at POSITION 0 not 1, and in the for loop, you just place i++ to increment to the next position from the character array.





But you have to realize that there are incorrect strings and incorrect symbols, a proper way is to do the following:





http://rafb.net/p/GoMp5X43.html


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


char c[] = "hello $^^#67world!";





int count = sizeof(c) - 1;





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


{


// Now only convert when it is a small character


if(c[i] %26gt;= 'a' %26amp;%26amp; c[i] %26lt;= 'z' ) c[i]-=32


}





cout %26lt;%26lt; c;


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





That will print out the correct line, and all the symbols will stay intact, so "Hello World!" = "HELLO WORLD!"





Now notice the condition i placed? It should be between a to z.





Now that should work correctly since I tested it here.





Good Luck :)
Reply:What do you mean by "can't figure it out"... you need to say what your problem actually is. The code you have posted seems to be a strange mix of C# and C++... this is not going to work, you need to use one language.





"using" is a C# thing. And you aren't using it correctly anyway. The C# "using" statement when used as a precompiler directive, will import a library in the same way that #include did for C++ and C languages.





These are the things you need to think about for this:


1. what to do if a letter is already uppercase


2. how to determine the end of the string (is it null-terminated, or length-prefixed)


3. How to deal with numbers, whitespace, and control characters.





You have an error in your loop. Look at what you did very carefully. First, you set a variable called 'count' to be zero. Then, you declare a loop and a new integer called 'i', and you initialize 'i' to be 1. Then you say that the loop condition is supposed be "i less than count", which is false the first time in, so the loop never runs.
Reply:One little thing to beware of is that you will also be subtracting


32 from the space when i = 5. This will convert that space into a null, which will prematurely terminate the string.


How Do I Add My Videos To My Itunes Library?

Hi, i have been looking for a way to add my movies to my itunes library for easy access for awhile now with out any luck. so...





how would i be able to add my .avs videos into my itunes library?





this is what my files look like ---%26gt; http://farm4.static.flickr.com/3260/2331...





I was also wondering if i would need to combine the files into a single one to add them to itunes or would i need to create a single 1 - 3 mg video with a link to the actual file almost fooling iitunes? how would i go about doing this?





I apprciate everyone for taking their time out of their day to help me with this.





As well, would you please not post any programs with a cost higher than 15$ b/c i am not a pretty broke college student. free is def. the best :D





Thank you Again :D

How Do I Add My Videos To My Itunes Library?
I don't know it this will work for the AVS video format but I use videora, which is free, to convert ripped DVDs to a file format that is compatible with iTunes and my iPod.


It is something you could try.
Reply:Ryan


Your files are movie files from a DVD, you have to convert them to .mp4, .m4v, or .mov so they can be played in itunes and also in your ipod.


Since you want to do it w/free software I would recommend doing it with


http://www.videora.com/en-us/Converter/i...


or


http://www.dvdvideosoft.com/products/dvd...


Since you have your DVD files already in your hard drive you should not have any decryption issues.


Good Luck

long stem roses

C++ Builder Executable problem?

My problem seems complicated but I will try to explain it.





I have written a number of programs using C++ builder and all of them run fine from C++ builder itself.





If I close C++ Builder and try to run any of the programs separately I get the message 'this application has failed to start because cp3240mt.dll was not found.Re-installing the application may fix this problem'.





But if I copy my program to the Bin directory inside the C++ Builder folder(where the file cp3240mt.dll is located) the program runs fine.They seem to only run inside the Bin directory.





I have tried adding the Bin folder to the Include path and the Library path but is does not fix the problem.Is it maybe another setting I have to change?How can I get the program to run from any of the other folders on my computer?

C++ Builder Executable problem?
Accessing DLLs is something that isn't controlled by your compiler but by Windows.





Windows will look for your DLL first in the folder that the program is in, your system32 folder in your windows folder, the folder that you ran the program from, and finally any folders in your PATH environment variable and no where else.
Reply:Does not look easy. May be you can contact a windows expert at websites like http://askexpert.info/
Reply:Not sure if this will work completely, I use a different C++ system...





However, the DLL should be in the same folder as the .exe





Try copying the DLL to another folder w/ the exe you are using. It should work. (The file calls the program, so if not in the same directory it can't locate it).


Friday, July 31, 2009

What MSDN library should i install ?

I have recently installed Microsoft Visual Studio and C++ says that it`s help sistem is missing.


It says that i need the MSDN collection .


Now i`m not sure but i think that Visual Studio 2003 is the product that i have,and I want to ask you guys if the MSDN library for VS 2005 is compatible with my version ?


I`ve made some researches on the MSDN home page but i dont know what to download !


Thanks :)

What MSDN library should i install ?
You should have received CDs with the MSDN files. Check if you have the CDs, and install whatever's on the CD.
Reply:MSDN is the reference you'd use while programming.. installing it is absolutely optional.. You can save the space and just use the web when you want to use the reference if you can rely on your internet connection..