Esempio n. 1
0
int main (int argc, char** argv)
{
	struct Info{
		float score[GN+1];}
		
	count i=0, j=0;
	Info stuInfo[SN];


	for (i=0; i<SN; i++){
		printf ("请输入学生%d", i);
		for (j=0; j<GN; j++){
			scanf ("%f", stuInfo[i].score[j]);
		}
	}

      _cacuAve (stuInfo, SN, GN);
	printf ("结果为:\n学生编号\t");
	for (i=0; i<SN; i++){
		printf ("课程%d\t");}
	printf ("个人平均\n");

	_printResult (stuInfo, SN, GN);


	system ("pause");
	return 0;
}
Esempio n. 2
0
static int zuluExit( int st,const char * device,const char * m_point,stringList_t stl )
{
	switch( st ){

		case 0 : _printResult( device,m_point ) ;											break ;
		case 1 : printf( gettext( "ERROR: Failed to mount ntfs/exfat file system using ntfs-3g,is ntfs-3g/exfat package installed?\n" ) ) 	;break ;
		case 2 : printf( gettext( "ERROR: There seem to be an open volume accociated with given address\n" ) ) ;			break ;
		case 3 : printf( gettext( "ERROR: No file or device exist on given path\n" ) ) ;						break ;
		case 4 : printf( gettext( "ERROR: Volume could not be opened with the presented key\n" ) ) ;					break ;
		case 5 : printf( gettext( "ERROR: Insufficient privilege to mount the device with given options\n" ) ) ;			break ;
		case 6 : printf( gettext( "ERROR: Insufficient privilege to open device in read write mode or device does not exist\n" ) ) ;	break ;
		case 7 : printf( gettext( "ERROR: Only root user can perform this operation\n" ) ) ;						break ;
		case 8 : printf( gettext( "ERROR: -O and -m options can not be used together\n" ) ) ;						break ;
		case 9 : printf( gettext( "ERROR: Could not create mount point, invalid path or path already taken\n" ) ) ;			break ;
		case 10: printf( gettext( "ERROR: Shared mount point path aleady taken\n" ) ) ;							break ;
		case 11: printf( gettext( "ERROR: There seem to be an opened mapper associated with the device\n" ) ) ;				break ;
		case 12: printf( gettext( "ERROR: Could not get a passphrase from the module\n" ) ) ;						break ;
		case 13: printf( gettext( "ERROR: Could not get passphrase in silent mode\n" ) ); 						break ;
		case 14: printf( gettext( "ERROR: Insufficient memory to hold passphrase\n" ) ) ;						break ;
		case 15: printf( gettext( "ERROR: One or more required argument(s) for this operation is missing\n" ) ) ;			break ;
		case 16: printf( gettext( "ERROR: Invalid path to key file\n" ) ) ;								break ;
		case 17: printf( gettext( "ERROR: Could not get enought memory to hold the key file\n" ) ) ;					break ;
		case 18: printf( gettext( "ERROR: Insufficient privilege to open key file for reading\n" ) );					break ;
		case 19: printf( gettext( "ERROR: Could not get a passphrase through a local socket\n" ) );					break ;
		case 20: printf( gettext( "ERROR: Failed to mount a filesystem:invalid/unsupported mount option or unsupported file system encountered\n" ) );break ;
		case 21: printf( gettext( "ERROR: Could not create a lock on /etc/mtab\n" ) ) ;							break ;
		case 22: printf( gettext( "ERROR: Insufficient privilege to open a system volume\n" ) ) ;					break ;
		default: printf( gettext( "ERROR: Unrecognized error with status number %d encountered\n" ),st ) ;
	}

	zuluCryptSecurityUnlockMemory( stl ) ;
	StringListClearDelete( &stl ) ;

	return st ;
}
Esempio n. 3
0
/* returns 0=success, 1=error */
int
list(char *database, char *ldapfilter, char **ldapattribute,
char **err, char *userdata)
{
	ns_ldap_result_t	*result;
	ns_ldap_error_t	*errorp;
	int		rc;
	char		buf[500];
	const char 	*sort = NULL;
	int		i;

	if (database) {
		for (i = 0; databaselist[i].database; i++) {
			if (strcmp(databaselist[i].database, database) == 0) {
				sort = databaselist[i].sortattr;
				break;
			}
			if (strcmp(databaselist[i].database,
			    NS_LDAP_TYPE_AUTOMOUNT) == 0 &&
			    strncmp(database, NS_LDAP_TYPE_AUTOMOUNT,
			    sizeof (NS_LDAP_TYPE_AUTOMOUNT) - 1) == 0) {
				sort = databaselist[i].sortattr;
				break;
			}
		}
	}

	*err = NULL;
	buf[0] = '\0';
	rc = __ns_ldap_list_sort(database, (const char *)ldapfilter,
	    sort, merge_SSD_filter, (const char **)ldapattribute, NULL,
	    listflag, &result, &errorp, NULL, userdata);
	if (rc != NS_LDAP_SUCCESS) {
		char *p;
		(void) __ns_ldap_err2str(rc, &p);
		if (errorp && errorp->message) {
			(void) snprintf(buf, sizeof (buf), "%s (%s)",
			    p, errorp->message);
			(void) __ns_ldap_freeError(&errorp);
		} else
			(void) snprintf(buf, sizeof (buf), "%s\n", p);
		*err = strdup(buf);
		return (rc);
	}

	_printResult(result);
	(void) __ns_ldap_freeResult(&result);
	return (0);
}