-3
Make a program that receives a 200 position vector (int)
Next create a function that returns the power squared of each element of the vector.
The main program should display all results on the screen.
#include <stdlib.h>
#include <time.h>
#include <windows.h>
#include <cstdio>
using namespace std;
int x, base, resp = 0, vet[200];
int calc(int base, int resp){
resp = (base * base);
return resp;
}
main(){
setlocale(LC_ALL, "Portuguese") ;
for (x = 0; x < 200; x++) {
vet[x] = x;
cout << endl << "Posição " << x + 1 << " : " << vet[x];
}
for (x = 0; x < 200; x++) {
cout << endl;
cout << endl << vet[x] << "² = " << calc(vet[x], resp);
}
getch();
}
Where is the error? It does not rotate.
The main prototype is correct ? --
int main( int argc, char ** argv )
– Lacobus
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site.
– Maniero
If you want you can signal that the question is anonymous but do not edit it so that without context or radically.
– rray