Показать сообщение отдельно

  #6  
Старый 13.05.2008, 22:13
avton0m
Познающий
Регистрация: 15.12.2007
Сообщений: 37
С нами: 9687089

Репутация: 15
По умолчанию

Delimiter, вроде так вот?

Код:
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <conio.h>

#define N 4

int m[N][N];
void fill_m();
void out_m();


int cnt[N];

int main()
{
 fill_m();
 out_m();

 for(int i=0;i<N;i++) // idem po personam
 {
  for(int j=0;j<N;j++) // idem po znakomstvam
  {
  if(m[i][j]==1) cnt[i]++;
  }
 }
 int top_m=0; // bolshe vsego znak
 int max=0;
 for(i=0;i<N;i++)
 {
  if(cnt[i]>max) {max=cnt[i]; top_m=i;}
 }


 cout << "\n\nOdna gruppa:\n";
 for(int j=0;j<N;j++)
 {
  if(m[top_m][j]==0) cout << " " << j << " ";
 }
 cout << " & " << top_m << "\n";

 out_m();
getch();
return 0;
}

void fill_m()
{
 for(int i=0;i<N;i++)
 {
  for(int j=0;j<N;j++)
  {
   cout << i << " with " << j <<": ";
   cin >> m[i][j];
  }
  cout << "\n";
 }
}

void out_m()
{
 for(int i=0;i<N;i++)
 {
  for(int j=0;j<N;j++)
  {
  cout << m[i][j];
  }
 cout << "\n";
 }

}

Последний раз редактировалось avton0m; 13.05.2008 в 22:26..
 
Ответить с цитированием