#include <iostream>
#include <string.h>
using namespace std;
int main() {
int num , n , n1 , k , x = 0;
cout << "Enter the no. of vertices: " ;
cin >> n;
char StorageArr[n];
char arr[k];
for(k = 0; k< n ; k++){
cout<< "arr[" << k << "] : ";
cin >> arr[k] ;
StorageArr[n] = arr[k];
}
int len = sizeof(StorageArr)/ sizeof(StorageArr[0]);
cout << "The length of the array is : " << len << endl;
for(int i= 0 ; i< len ; i++){
for(int j = 0; j< len ; j++ ){
cout<<"\n\t" <<"Element at " << StorageArr[i] << StorageArr[j] << ": " ;
cin >> num;
if(i==j && num == 0){
x++;
}
}
}
if(x == len){
cout<<"This is a complete graph...";
}else{
cout<< "This is not a complete graph..." ;
}
return 0;
}
ok so how is StorageArr[n] = arr[k] is working. I mean if we assign n = 5 then all the value of arr[k] will be assign to the same position StorageArr[5] or will it be that the value of arr[k] will store in StorageArr as like first on 0th pos then on 1st postion and then so on till 4th....
Aucun commentaire:
Enregistrer un commentaire