Guest User

Untitled

a guest
Apr 25th, 2012
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. bool somma_quadrati(int Matrice[3][3], int F){
  7. F=285;
  8. int D;
  9. int totale_somma;
  10. for(int j=0; j<3; j++){
  11. for(int i=0; i<3; i++){
  12. D=pow(Matrice[i][j],2);
  13. totale_somma+=D;
  14. if(totale_somma==F){
  15. cout<<true;
  16. }else{
  17. cout<<false;
  18. }
  19.  
  20. }
  21. }
  22.  
  23.  
  24. return true;
  25. }
  26.  
  27. int main(){
  28. int Matrice[3][3]; // matrice 3x3 da riempire e corrisponde ad un quandrande del sudoku
  29. int A; // variabile che assumerĂ  i valori inseriti
  30. for(int j=0; j<3; j++){
  31. for(int i=0; i<3; i++){ // i due for servono per riempire la matrice
  32. if(A<=1&&A>=9){
  33.  
  34. cout<<">>INSERISCI I VALORI DLLA MATRICE 3x3<<\n";
  35. cout<<"(inserire solo numeri compresi tra 1 e 9!!\n";
  36. cin>>A;
  37. Matrice[i][j]=A;
  38. }
  39. }
  40. }
  41. int somma_quadrati;
  42. cout<<somma_quadrati;
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment