예제 #1
0
파일: BRCKTS1.cpp 프로젝트: AgarPiyush/Spoj
int main()
{
	int m,j,t=1;
	for(t=1;t<=10;t++)
	{
		printf("Test %d:\n",t);
		fscan(&l);
		max=0;
		scanf("%s",s);
		segment(1,0,l-1);
		fscan(&m);
		for(j=0;j<m;j++)
		{
		fscan(&k);
		if(k==0)
		{
			if(a[1][0]==a[1][1]&&a[1][0]==0)
			printf("YES\n");
			else
			printf("NO\n");
		}
		else
		{
		k--;
		update(1,0,l-1,k);
		}
		}
	}
	return 0;
}
예제 #2
0
void advance_book(char* student_id) {
  char* adbook_menu[] = {
    "cCheck free computers",
    "iInput slot details",
    "bBack",
    0,
  };
  int choice;
  char* name;
  
  name = fscan(student_id,'n');
  initscr();
  do{
    choice= getchoice(name,adbook_menu);
    switch(choice) {
      case 'b':
        break;
      case 'c':
	check_status(student_id);
	break;
      case 'i':
    clear_login_screen(student_id);
	adv_book(student_id);
	break;
    }
  }
  while(choice!='b');
  endwin();
}
void Tree::importFrom(const char *filename)
{
	std::ifstream fin;
	fin.open(filename);
	int gpn;
	fin >> gpn;
	setGPno(gpn);
	fscan(fin, root());
	fin.close();
}
void Tree::fscan(std::ifstream &fin, Node *node)
{
	int lv, nchild, toexp;
	std::string type, data;
	fin >> lv >> type >> data >> nchild >> toexp;
	node->reset(lv, type, data, (toexp > 0));

	for (std::size_t i = 0; i < nchild; i += 1)
	{
		Node x;
		node->getChildrenNodes().push_back(x);
		fscan(fin, node->child(i));
	}
}
예제 #5
0
int main()
{
 printf("--------WELCOME TO SPELLCHECKER--------\n\n\n");
    printf("CREATED BY JYOTI SAINI\n");
	struct TrieNode *root=NULL;
//struct TrieNode *root;
	//root=NULL;
	char spell[30];
	root=fscan(root);
	//fprint(root);
	struct bkTree*node=NULL;
	//char flag='y';
	while(1)
    {

    printf("CHOOSE FROM THE FOLLOWING OPTIONS\n");

	printf("(i)i--to insert a new word into the database\n");
	printf("(ii)s--to search a word in the database\n");
	printf("(iii)a--to autocomplete a word\n");
	printf("(iv)p--to print the entire database\n ");
	printf("(v)w--to get suggestion for wrong spelling\n");
	char ch;
	scanf("%s",&ch);
	switch(ch)
	{
	    case 'i':
	        printf("enter a word to be inserted\n");
	    scanf("%s",&spell);
    strlwr(spell);
	    //root=trieCreate();
	      root= insert(root,spell);
	        printf("word has been updated in database\n");
	        fprint(root);
	        break;
	       case 's':
	            printf("enter word to be searched\n");
	        scanf("%s",&spell);
	        bool x=search(root,spell);
	        if(x==false)
	        printf("word not found!!!");
	        else printf("word found!!");
	        fprint(root);
	        break;
	        case 'a':
                printf("enter prefix of the word to be completed\n");
                scanf("%s",spell);
                 x=autocomplete(root,spell);
                 if(x==false)
                    printf("no prefix exist");
                break;
            case 'p':
                printdata(root);
                break;
            case 'w':
               // struct bkTree*node=NULL;
                node=fscanBK(node);
                printf("enter word to get suggestions\n");
                scanf("%s",&spell);
                suggestion(node,spell);
                break;

	}
	printf("do you want to perform any other task(y/n)\n");
	char x;
	scanf("%c\n",&x);
	if(x=='n'||x=='N')
        break;

    }
	//print(root);
	return 0;
}
예제 #6
0
void clear_login_screen(char* name) {
  clear();
  mvprintw(2,COLS/3,"%s","DCF Login Systems");
  mvprintw(LINES-1,0,"Logged in as: %s (%s)",name,fscan(name,'n'));//
  refresh();
}