본문 바로가기

전체 글113

[C] 함수를 통해 로또 번호 생성, 출력하기 (난수 사용) 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748#define _CRT_SECURE_NO_WARNINGS#include stdio.h>#include stdlib.h>#include time.h> void input_nums(int* lotto_nums);void print_nums(int* lotto_nums); int main(void) {     int lotto_nums[6];    srand(time(NULL));     input_nums(lotto_nums);    print_nums(lotto_nums);     return 0;}void input_nums(int* lotto_num.. 2020. 11. 10.
[C] 시험 별 성적 최소값, 최대값 구하기 한 학급은 최대 10명 까지의 학생들로 구성되어 있다. 각 학생들은 3번의 시험을 치른다. 학생들의 성적은 난수를 생성하여 얻는다. 각 시험에 대하여 최대점수와, 최저점수를 계산하여 출력한다. 12345678910111213141516171819202122232425262728293031323334#include stdio.h> void get_minmax(int score[][3]){    int i, s, min, max;    for (s = 0; s  3; s++) {        min = max = score[0][s];        for (i = 0; i  10; i++) {            if (score[i][s]  min) min = score[i][s];            i.. 2020. 11. 10.
[C] 성적 구하는 프로그램 (난수, 다차원 배열 사용) 1) 난수로 생성된 성적 구하기 (학생 별 점수, 점수 총점, 점수 평균, 과목 별 평균 출력) 1234567891011121314151617181920212223242526272829303132333435363738394041#include stdio.h>#include stdlib.h>#include time.h> int main(){    int scores[3][4];    int i, j;    int tot = 0;    double avg;    double average[4] = { 0 };    srand(time(NULL));                     // 자료생성    for (i = 0; i  3; i++)        for (j = 0; j  4; j++)       .. 2020. 11. 10.
[Flask] SQLite 예제 Flask – SQLite - TutorialspointFlask – SQLite Python has an in-built support for SQlite. SQlite3 module is shipped with Python distribution. For a detailed tutorial on using SQLite database in Python, please refer to this link. In this section we shall see how a Flask application intewww.tutorialspoint.com     1234567891011121314import sqlite3 conn = sqlite3.connect('database.db')print('데이터베이스.. 2020. 9. 24.
[Flask] File Uploading 예제 (파일 제출 안할 경우 flash로 에러메시지 출력) Uploading Files — Flask Documentation (1.1.x)Uploading Files Ah yes, the good old problem of file uploads. The basic idea of file uploads is actually quite simple. It basically works like this: A tag is marked with enctype=multipart/form-data and an is placed in that form. The application accesses thflask.palletsprojects.com  Flask – File Uploading - TutorialspointFlask – File Uploading Handli.. 2020. 9. 24.
[Flask] Message Flashing 예제 Flask – Message Flashing - TutorialspointFlask – Message Flashing A good GUI based application provides feedback to a user about the interaction. For example, the desktop applications use dialog or message box and JavaScript uses alerts for similar purpose. Generating such informative messageswww.tutorialspoint.com     123456789101112131415161718192021222324from flask import Flask, flash, redi.. 2020. 9. 24.
[Flask] Redirect & Errors 예제 Flask – Redirect & Errors - TutorialspointFlask – Redirect & Errors Flask class has a redirect() function. When called, it returns a response object and redirects the user to another target location with specified status code. Prototype of redirect() function is as below − Flask.redirect(locatwww.tutorialspoint.com    12345678910111213141516171819202122from flask import Flask, redirect, url_fo.. 2020. 9. 24.
[Flask] Sessions 예제 Flask – Sessions - TutorialspointFlask – Sessions Like Cookie, Session data is stored on client. Session is the time interval when a client logs into a server and logs out of it. The data, which is needed to be held across this session, is stored in the client browser. A session with eawww.tutorialspoint.com  1234567891011121314151617181920212223242526272829303132333435363738394041424344454647.. 2020. 9. 24.
[Flask] Cookies 예제 Flask – Cookies - TutorialspointFlask – Cookies A cookie is stored on a client’s computer in the form of a text file. Its purpose is to remember and track data pertaining to a client’s usage for better visitor experience and site statistics. A Request object contains a cookie’s awww.tutorialspoint.com  웹사이트는 쿠키를 통해 접속자의 장치를 인식하고,접속자의 설정과 과거 이용내역에 대한 일부 데이터를 저장한다.      1234567891011121314151617.. 2020. 9. 24.
[Flask] jinja template 활용하여 static 폴더의 자료 가져오기 1234567891011121314 # jinja 탬플릿을 활용하여 static 폴더의 자료를 가져오는 예제.  from flask import Flask from flask import render_template app = Flask(__name__) @app.route('/')def index():   return render_template('index.html') if __name__ == '__main__':   app.run(host='0.0.0.0', port = 80, debug = True)     1234567891011121314!DOCTYPE html>html lang="ko">head>    meta charset="UTF-8">    meta name="viewport" con.. 2020. 9. 24.