Create multiple C language programs in one compile

in #utopian-io6 years ago (edited)

What Will I Learn?

  • You will learn basic C language
  • You will learn to make simple programs
  • You will learn how to combine multiple programs in one compile

Requirements

  • Have a basic knowledge of C language
  • DEV C ++ Compile and Run C/C++ program on Windows
  • GCC Compile and Run C / C ++ program on Linux

Difficulty

  • Basic

Tutorial Contents

  • What is a C programming language ?
  • What is the use and should learn ?

Programming Language C

C Programming Language is a computer programming language that can be used to create applications (general-purpose programming language), from operating systems (such as Windows or Linux), antivirus, image processing software, to compilers for programming languages, where C is widely used to create other programming languages ​​which one of them is PHP.

Although it is a general-purpose programming language, a programming language that can create applications, C programming languages ​​are best suited for designing applications that deal directly with Operating Systems and hardware.

  • So my goal is how to make some simple program. And combine some simple programs that we have created later into one compile

Some examples of simple C programs

  • C program distinguishes small and large numbers, and use if else condition
#include <stdio.h>
int main(){
    
    int i,x,j;
    
    printf("Masukkan Angka Pertama : ");
    scanf("%d",&i);
    printf("Masukkan Angka Kedua : ");
    scanf("%d",&x);
    
    if(i>x){
        printf("Angka %d Lebih Besar Dari %d",i,x);
    }
    else if(i<x){
        printf("Angka %d Lebih Kecil Dari %d",i,x);
    }
    else {
        printf("Error!");
    }
}

  • make declarations on the program
 int i,x,j;

  • This is to receive the first and second number input
    printf("Masukkan Angka Pertama : ");
    scanf("%d",&i);
    printf("Masukkan Angka Kedua : ");
    scanf("%d",&x);

  • And this is the if and else condition to process the first and second number input
if(i>x){
        printf("Angka %d Lebih Besar Dari %d",i,x);
    }
    else if(i<x){
        printf("Angka %d Lebih Kecil Dari %d",i,x);
    }
    else {
        printf("Error!");
    }

  • Save and Run.

image.png

  • The C program is looping using FOR
#include <stdio.h>
int main(){
    
    int i;
        
    for(i=1;i<=10;i++){
        
        printf("\n%d Welcome Utopian-IO \n", i);
        
    }       
}
  • Save And Run

image.png

  • A simple C program uses While
#include <stdio.h>
int main(){
    
    int j;
    j=1;
    while(j<=10){
        
        printf("%d",j);
        j++;
        
    }       
}
  • Save and Run

image.png

Merging several C programs to be compiled simultaneously

  • When finished we create three simple programs using C language, namely: - Programs distinguish small and large numbers, FOR loops, and WHILE programs.

  • Now it's time we combine all the above programs for the COMPILE simultaneously, see the programs I've combined below:

#include <stdio.h>
int main(){
    
    int i,x,j;
    
    printf("Masukkan Angka Pertama : ");
    scanf("%d",&i);
    printf("Masukkan Angka Kedua : ");
    scanf("%d",&x);
    
    if(i>x){
        printf("Angka %d Lebih Besar Dari %d",i,x);
    }
    else if(i<x){
        printf("Angka %d Lebih Kecil Dari %d",i,x);
    }
    else {
        printf("Error!");
    }
        
    
    for(i=1;i<=10;i++){
        
        printf("\n%d Welcome Utopian-IO \n", i);
        
    }
    
    j=1;
    while(j<=10){
        
        printf("%d",j);
        j++;
        
    }
    
        
}


  • Save And Run

image.png

  • And that's some simple C programming language and how to merge multiple programs in a single compile.

  • This tutorial is recommended for newly learned C programming languages, and is not recommended for advanced level.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.

Your tutorial is far too trivial to be accepted.

You can contact us on Discord.
[utopian-moderator]

Congratulations @otakngoding! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

Click here to view your Board

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @otakngoding! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 58994.66
ETH 2596.74
USDT 1.00
SBD 2.43