Answer to Question #18321 in C++ for Lukundo Kileha

Question #18321
a)i want to know the actual meaning of the following terms and how i can work with them
1.libraries
2.syntax errors
3.semantic errors
b)how can code a program which will display the integers in descending or ascending order using while
1
Expert's answer
2012-11-13T10:41:42-0500
C++
a)i want to know the actual meaning of the following terms and how i can work with them
1.libraries

In computer science, a library is a collection of non-volatile resources used by programs on a computer, often to develop software. These may include configuration data, documentation, help data, message templates, pre-written code and subroutines, classes, values or type specifications.
Libraries contain code and data that provide services to independent programs. This encourages the sharing and changing of code and data in a modular fashion, and eases the distribution of the code and data. Library files are not executable programs. They are either static libraries that are merged with an executable when the executable is being compiled and linked, making them "statically linked", or they are dynamic libraries that are loaded by a dynamic linker while the executable is running, making them "dynamically linked". The dynamic linker may also allow an application to explicitly request that a module be loaded and to obtain references to routines in the module; this can be used to implement plug-ins.
Most compiled languages have a standard library although programmers can also create their own custom libraries. Most modern software systems provide libraries that implement the majority of system services. Such libraries have commoditized the services which a modern application requires. As such, most code used by modern applications is provided in these system libraries.
Libraries often contain a jump table of all the methods within it, known as entry points. Calls into the library use this table, looking up the location of the code in memory, then calling it. This introduces overhead in calling into the library, but the delay is so small as to be negligible.
In the C++ programming language, the C++ Standard Library is a collection of classes and functions, which are written in the core language and part of the C++ ISO Standard itself. The C++ Standard Library provides several generic containers, functions to utilize and manipulate these containers, function objects, generic strings and streams (including interactive and file I/O), support for some language features, and everyday functions for tasks such as finding the square root of a number. The C++ Standard Library also incorporates 18 headers of the ISO C90 C standard library ending with ".h", but their use is deprecated. No other headers in the C++ Standard Library end in ".h". Features of the C++ Standard Library are declared within the std namespace.
The C++ Standard Library is based upon conventions introduced by the Standard Template Library (STL). Although the C++ Standard Library and the STL share many features, neither is a strict superset of the other. In particular, the C++ Standard Library has also been influenced by the work of Alexander Stepanov and Meng Lee.
The C++ Standard Library underwent ISO standardization as part of the C++ ISO Standardization effort, and is undergoing further work regarding standardization of expanded functionality.

2.syntax errors

In computer science, a syntax error refers to an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language. For compiled languages syntax errors occur strictly at compile-time. A program will not compile until all syntax errors are corrected. For interpreted languages, however, not all syntax errors can be reliably detected until run-time, and it is not necessarily simple to differentiate a syntax error from a semantic error; many don't try at all.

3.semantic errors

Semantic error - an error in logic or arithmetic that must be detected at run time.

b)how can code a program which will display the integers in descending or ascending order using while



#include <stdio.h>
#include <iostream.h>

void bubbleSortDescending(int *array,int length)
{
int i=0,j;
while (i<length)
{
& j=0;
& while (j<i)
& {
if(array[i]>array[j])
{
int temp=array[i];
array[i]=array[j];
array[j]=temp;
}
& j++;
& }
i++;
}

}

void bubbleSortAsscending(int *array,int length)
{
int i=0,j;
while (i<length)
{
& j=0;
& while (j<i)
& {
if(array[i]<array[j])
{
int temp=array[i];
array[i]=array[j];
array[j]=temp;
}
& j++;
& }
i++;
}

}

void printElements(int *array,int length)
{
int i=0;
for(i=0;i<10;i++)
& cout<<array[i]<<endl;
cout<<"\n";
}


void main()
{
int a[]={9,6,5,23,2,6,2,7,1,8}; // array to sort
bubbleSortDescending(a,10); // call to bubble sort&
printElements(a,10); & // print elements

int b[]={9,6,5,23,2,6,2,7,1,8};
bubbleSortAsscending(b,10);
printElements(b,10);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
15.11.12, 15:04

You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!

lukundo kileha
14.11.12, 19:11

thank you so much

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS