Пример #1
0
void check(char user1, char user2)
{
int temp=0;
int temp1=0;
char choice2;
v1=v2=head;
while(v1!=NULL)    
{
    if (v1->value != user1){
        v1=v1->next;
    temp=1;}
    else{
        temp=0;
    break;}
    }
if(temp==1)
{
printf("User %c not found. Do you want to insert? (Y/N)\n", user1);
fflush(stdin);
scanf("%c", &choice2);
if(choice2=='Y'||choice2=='y')
    insertuser();
    else 
        main();
    
  
}
    
while(v2!=NULL)    
{
    if (v2->value != user2){
        v2=v2->next;
    temp1=1;}
    else{
        temp1=0;
    break;}
    }
if(temp1==1)
{
printf("User %c not found. Do you want to insert? (Y/N)\n", user2);
fflush(stdin);
scanf("%c", &choice2);
if(choice2=='Y'||choice2=='y')
    insertuser();
    else 
    main();
  
}
}
Пример #2
0
main()
{
char user1;
char user2;   
    
int choice;

	
	while(1) {
		printf("What do you want to do?\n\n");
		printf("1. Insert a user \n2. Insert a friendship \n3. To show friendship \n4. Exit\n");
		scanf("%d", &choice);
		
		switch(choice) {
			case 1:
				
				insertuser();
				printf("\nInserted the user %c into linkedList\n", value1); 
				break;
			case 2:
				printf("\nEnter the First user name for friendship!!\n");
              fflush(stdin);
              scanf("%c",&user1);
              printf("\nEnter the Second user name for friendship!!\n");
              fflush(stdin);
              scanf("%c",&user2);
				insertfri(user1,user2);
				printf("\nFriendship is built between %c and %c\n",user1,user2); 
				break;
			case 3:
				
				display();
                break;
            
           case 4:
                printf("\nExiting...\n"); 
                  exit(0);   
			default:
				break;
		}
	}
}
Пример #3
0
void clinterface::newuser(int fd, char *peer, int portnum, int g)
{
   insertuser(new cluser(fd,this,peer,portnum,g));
}