Code:
int i;
int sum = 0;
for(i = FIRST_VALUE; i < STOP_VALUE; i++)
{
sum += f(i);
}
int i;
int sum = 0;
for(i = FIRST_VALUE; i < STOP_VALUE; i++)
{
sum += f(i);
}
int factorial(int n)
{
int result = 1;
while(n > 1)
{
result *= n;
n--;
}
return result;
}
int solve(int chess_board[][], int last_col, int last_row,
for (nRows = 0; nRows < m_nRows; nRows++)
{
for (nCols = 0; nCols < m_nCols; nCols++)
{
...
}
}
for(nRows = 1; nRows < m_nRows; nRows++)
{
if( matrix[nRows][nRows] != matrix[0][0] )
// not a scalar matrix
}
// is a scalar matrix
int i = 1;
int count = 0;
while(i <= input)
{
while(count < ((2*input)+3))
{
if( ... )
print a space
else if( ... )
print count
else if ( ... )
print either input or count
Enter a number: 5 5 4 3 2 1
void printBinary(int input)
{
for(int i = 31; i >= 0; i--)
cout << ((input && (1 << i)) >> i);
cout << endl;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << setiosflags(ios::fixed) << setprecision(5);
double x;
cout <<
8 0 8 0 8 0 8 0 8
reverse(s.begin(), s.end());
double sum (double factors)
{
double sum;
for (double n=1; n<=100; n++)
[b]sum = pow(x,n)/factorial(x);[/b]
return sum;
}
sum += pow(x,n) / factorial(x);
estimate = 1 + sum(x);
open text file
// it would be nice if it told you how many lines to make it
while(not end of file)
{
str = get next line
if(array full)
make a bigger array
insert str into next open spot in array
increment index for next open
}
close the text file
for(int i = 0; i < NEXT_OPEN_ENTRY; i++)
{
output each sentence
Leave a comment: