我需要知道如何将 #include <stdio.h>
int main()
{
float gpa;
float numberGrade = 0;
float sum = 0;
int i, numCourse;
char letterGrade, modifier;
printf("Enter the number of course: ");
scanf("%d", &numCourse);
for (i = 0; i < numCourse; i++)
{
printf("What grade did you earn?\n");
printf("Enter A, B, C, D, or F: ");
scanf(" %c", &letterGrade);
switch (letterGrade)
{
case 'A':
numberGrade = 4.0;
break;
case 'B':
numberGrade = 3.0;
break;
case 'C':
numberGrade = 2.0;
break;
case 'D':
numberGrade = 1.0;
break;
default:
numberGrade = 0.0;
break;
}
printf(
"Enter modifier - for letter grades A-, etc. + for letter grades B+, etc. , and _ for letter grades A, B, etc.: ");
scanf(" %c", &modifier);
if (modifier == '-')
numberGrade = numberGrade - 0.3;
else if (modifier == '+')
numberGrade = numberGrade + 0.3;
sum = sum + numberGrade;
}
gpa = sum / numCourse;
printf("The final gpa is %.2f.\n", gpa);
return 0;
}
连接为主数据库。
请指导我连接数据库
答案 0 :(得分:-1)
安装mongoengine
app
在settings.py
文件中,您可以添加以下内容..
在'mongoengine.django.mongo_auth',
INSTALLED_APPS
AUTH_USER_MODEL =&#39; mongo_auth.MongoUser&#39;
SESSION_ENGINE =&#39; mongoengine.django.sessions&#39;
SESSION_SERIALIZER =&#39; mongoengine.django.sessions.BSONSerializer&#39;
from mongoengine import connect
connect('database_name', host='***.***.**.**', port=27017)
DATABASES = {
'default': {
'ENGINE': '',
'NAME': '',
}
}