[visual-studio] How do you auto format code in Visual Studio?

#include "stdafx.h"
#include <stdio.h>


int main(){
    char filename[15];

    printf("Enter file name:");
    scanf("%s", filename);
    Automat(filename);
    freq(filename);
}

int Automat(char filename[]){

    FILE*fp;
    char c;
    int state = 1;
    int duma = 0;
    fp = fopen(filename, "r");
    if (fp == NULL){
        printf("Error");
        system("pause");
    }
    while (!feof(fp)){
        c = fgetc(fp);

        switch (state){
        case 1:
            if (c == '\t' || c == '\n' || c == ' '){
                state = 3;
                break;
            }
        case 2:
            if (c >='A'|| c<='Z'){
                break;
            }

        case 3: duma++;
            state = 1;
            break;
        }
    }
    printf("Broq e : %d\n", duma);
    return 1;
}
int freq(char filename[]){

    FILE*fp;
    char c;
    int state = 1, sequence = 0;
    fp = fopen(filename, "r");
    if (fp == NULL){
        printf("Error");
        system("pause");
    }



    while (!feof(fp)){
        c = fgetc(fp);
        switch (state){
        case 1:
            if (c >= 'A' && c <= 'Z'){
                state = 2;
                break;
            }

        case 2:
            if (c == '\t' || c == '\n'||c == ' '){
                sequence++;
                state = 1;
                break;

            }
        }

    }
    printf("Sequence is : %d\n", sequence);
}