Answer to Question #1345 in Action Script | Flash | Flex | ColdFusion for sam20111

Question #1345
Write a c++ program that reads 10 integers save them in an array called A , and then prints the square of the elements of the array A ?
1
Expert's answer
2011-01-17T05:14:53-0500
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char **argv)
{
& int* A = new int[10];
& cout << "Please input 10 integers:" << endl;
& for(int i = 0; i < 10; i++)
& {
cin >> *(A + i);
& }
& cout << "Squares of the elements:" << endl;
& for(int i = 0; i < 10; i++)
& {
cout << pow(*(A + i), 2) << " ";
& }
& delete[] A;
}

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

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS