Rezultati

Up. imeNalogaJezikRezultatČas oddaje
_NABLA-2017 Prijateljske besede C Se ne prevede 20. apr '17 @ 20:18

Izpis prevajalnika:
source.c: In function ‘main’:
source.c:37:5: error: expected ‘;’ before ‘for’
     for(j=0;j<n;j++){
     ^
source.c:43:1: error: expected declaration or statement at end of input
 }
 ^
source.c:24:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ^
source.c:27:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", besede[i]);
     ^

Ocenjevani program (prijateljske.c):
#include  <stdio.h>
#include <string.h>

typedef struct prefix{
  int num;
  char visited;
  char pre[4];
  int link[3001];
}prefix;

struct postfix{
  int num;
  char pos[4];
  int link[3001];
};

typedef struct postfix postfix;

postfix po[3001];
prefix pr[3001];
char besede[3001][12];
int main(){
  int j,t,i,n, po_fr=0, pr_fr=0;
  scanf("%d", &n);
  char neki[12];
  for(i=0;i<n;i++){
    scanf("%s", besede[i]);
  }
  for(i=0;i<n;i++){
    pr[i].visited=0;
    pr[i].num=0;
    pr[i].pre[0] = neki [0];
    pr[i].pre[1] = neki [1];
    pr[i].pre[2] = neki [2];
    pr[i].pre[3] = 0;
    t=strlen(besede[i])
    for(j=0;j<n;j++){
      if(!strcmp(besede[i]+t-3, besede[j]+strlen(besede[j])-3)){
	pr[i].link[pr[i].num++]=j;
      }     
    }

}