Tuesday, July 14, 2009

C++ for beginners desperate for answers?

i really need your help badly





describe the differences between a compiler error and a link error





explain the following bitwise operations in c++


a) and b) or





what is meant by the term zero indexed





what does the address operator do





what is a UML





list the permission values assigned to the number 0,1,2, and 4

C++ for beginners desperate for answers?
You really ought to do this part yourself. With so many questions, you could have least presented us with your answers—right or wrong.





This is the easy part. If you don't truly take the time and energy to research and understand these fundamentals, and you continue with such laziness and indifference, you will most certainly get a poor grade.





What will you do when it comes time to design, write, and debug increasingly complex programs?





______________
Reply:A compiler error means an error was discovered while compilation which could be a syntax error (e.g. you forgot a semicolon) or a semantic error (e.g. you make an equality between a string and an integer).


A link error means an error was discovered while linking, consider the following code:


void Factorial(int num);


void main()


{


printf("%d", Factorial(4));


}


Here, you told the compiler that you have a function called "Factorial" and you tried to use it while you didn't specify how it works.





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





Try to realize "AND" and "OR" logically, for example:


AND means that both conditions are true while "OR" means at least one of the conditions is true. By using such definition as bitwise operators:


5 AND 4 = 4


If you considered that "1" means "true" and 0 means "false" then by converting 5 and 4 to binary values:


1 0 1 (5)


1 0 0 (4)


--------


1 0 0 (4)


The most left bit in the result is the only bit which is "1" because the most left bit in both "5" and "4" is "1".


By ORing them:


1 0 1 (5)


1 0 0 (4)


-------


1 0 1 (5)


Because OR requires only one of the bits to be "0" so the first and last bit were "1".





----------------------





Zero indexed means that "0" represents the first item in a collection. For example when you want to get the value of the first element in an array you use the following way:


int x[4];


int y;


y = x[0];


Because arrays are zero indexed, so you refered to the first item by "0" not "1".





----------------------





The address operator shows where the variable is stored in the memory not the value. For example:


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


void main()


{


int x = 5;


printf("%p %d", %26amp;x, x);


}


This program will output where "x" resides in the memory and the value stored in that location.





------------------------------





UML is a modeling language which is used for designing programs, it stands for "Unified Modeling Language". It is mainly composed of some figures which represents the components of that program and the relation between them.





---------------------------------





Unfortunately I don't understand the last question, sorry.
Reply:A compile error occurs because the source code has a logic error in it. A link error occurs when you try to link you code to already compiled libraries





I never did get bitwise operators try this:


http://www.cprogramming.com/tutorial/bit...


personally i never use them.





Zero indexed (i think) means that an array (or array like data) is indexed starting at 0. So the first item would be name[0], the second item name[1] and so on. Note: There is a philosophicall diffrene from how we normally think. Exe first cow is cow 1 second 2 ect.





If its this "%26amp;" it returns the address of the variable that it is in front of instead of the value of the variable.





UML is a type of way to map out what your program is going to do. I don't use it so I would look here:


http://en.wikipedia.org/wiki/Unified_Mod...





Honestly I have no clue Good luck.
Reply:If you're talking about UNIX permissions, this site (http://www.perlfect.com/articles/chmod.s... should help.


No comments:

Post a Comment