Microsoft Office Tutorials and References
In Depth Information
F.4 Visual C++
For comparison purposes, here is the C language version of the BASIC program that computes the
average of some numbers. I think you will agree that it is not quite as readable as the earlier
BASIC version. Lines beginning with // are comment lines that are ignored by the computer.
// C program to compute the average
// of a set of at most 100 numbers
#include <stdio.h>
void main(void)
{
// Declare some variables
int Num, i;
float Sum, NextNum, Ave;
// Ask for the number of numbers
printf( "Enter number of numbers: " );
scanf( "%u", &Num );
// If Num is between 1 and 100 then proceed
if( (Num > 0) && (Num <= 100) )
{
Sum = 0.0;
// Loop to collect the numbers to average
for( i = 1; i <= Num; i++ )
{
// Ask for next number
printf( "Enter next number: " );
scanf( "%f", &NextNum );
// Add the number to the running sum
Sum += NextNum;
}
// Compute the average
Ave = Sum / Num;
//Display the average
printf ("The average is: %f\n", Ave );
}
}
An object-oriented extension to C, known as C++, was developed in the early 1980s by Bjarne
Stroustrup (also at Bell Labs).
F.4 Visual C++
Despite the significant strides that Visual Basic has taken, it is not, in general, the preferred
language for creating complex standalone Windows applications. That role belongs to Microsoft's
Visual C++.
Actually, this is a good thing. Microsoft must guard against trying to make any single language the
solution for too many diverse programming needs. Such an effort can only be counterproductive.
By increasing the power of Visual Basic (and VBA) in order to handle more diverse and
sophisticated application programming, the language becomes more complex and difficult to learn
and use. This will result in the language being used by fewer people.
 
Search JabSto ::




Custom Search