Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,163,408 members, 7,853,807 topics. Date: Saturday, 08 June 2024 at 02:40 AM

Mikeblitz's Posts

Nairaland Forum / Mikeblitz's Profile / Mikeblitz's Posts

(1) (of 1 pages)

Programming / Re: C/c++ Helper. by mikeblitz: 4:11am On Dec 15, 2011
guys i need help ASAP since i need to submit this miniproject and i need 1 more minor questions need asnwered.

the C++ coding is given below, i need to change it to function type but giving out the same output.


#include <iostream>
#define SIZE 7
using namespace std;

int main()
{

int A[ SIZE ] = { 2, 4, 8, 16, 32, 64, 128};
int i, j;
int total = 0;


cout <<"Value of array: ";
for ( j = 0; j <SIZE; j++)
cout<< A[j] <<" ";
cout<<endl;

for ( i = 0; i < SIZE; i++ )
{
total += A[i];
}

cout << "Total of 2 power n from 2 to 128 are: "<<total;
return 0;

}


thanks in advance if anyonemanaged to answer it within 30 minutes from now.

(1) (of 1 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 4
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.