LEARN FULLSTACK #1

GIVE ME A CUP OF COFFEE

GET ME A CUP OF COFFEE SO I CAN GET YOU FREE RTICLES MORE QUICKLY

$1.00

BASICS

Fullstack web development can be divided into 2 parts front end and backend.There are various frameworks for doing front end development,the most commomly used is React JS we will use it to develop websites but we will focus moe on the backend since that handles your website the design or the front end part can be done even without no prior knowledge of coding.We will learn more about backend by setting up our development environment we will learn node js by express framework which is most commonly used even by big companies.

C PROGRAMME#5:BUILD A TIC TAC TOE GAME

  • #include<stdio.h>
  • #include<stdio.h>
  • char square[10]={0,1,2,3,4,5,6,7,8,9};
  • int choice, player;
  • int checkforwin();
  • void gameboard(char mark);
  • void displayboard();
  • void main()
  • {
  • int player;char mark;
  • for(i=1;i<-2;i–)
  • {
  • player=(player%2)?1;2;
  • printf(“Player%d enter a number:”,player);
  • scanf(“%d”,&choice);
  • mark=(player==1)?X;O;
  • gameboard(mark);
  • player++;
  • }
  • }
  • int checkforwin()
  • {
  • if (square[1]==square[2]&&sqaure[2]==square[3])
  • {
  • return 1;
  • }
  • else if(square[4]==square[5]&&sqaure[5]==sqaure[6]
  • return 1;
  • else if(square[7]==sqaure[8]&&square[8]==sqaure[9])
  • return 1;
  • else if(square[2]==square[5]&&square[5]==square==[8])
  • return 1:
  • else if(square[1]==square[4]&&square[4]==square[7])
  • return 1;
  • else if(square[3]==square[6]&&square[6]==square[9])
  • return 1;
  • else if(square[1]==square[5]&&square[5]==square[8])
  • return 1;
  • else if(square[3]==square[5]&&square[5]==square[7])
  • return 1;
  • else if (square[1]!=’1’&&square[2]!=’2’&&square[3]!=’3’&&square[4]!=’4’&&square[5]!=’5’&&square[6]!=’6’&&square[7]!=’7’&&square[8]!=’8’&&square[9]!=’9′)
  • return 0;
  • else
  • return -1;
  • }
  • system(“cls”); //please see if you are running on compilers like turbo c use clrscr()in this function to clear output important for getting only the output we want.//
  • void displayboard()
  • {
  • printf(“Player 1(X) PLAYER2(O)”);
  • printf(” %c|%c|%c \n”,square[1],square[2],square[3];
  • printf(“%c|%c|%c|\n”square[4],square[5],square[6];
  • printf(“%c|%c|%c|\n”square[7],square[8],square[9];
  • }
  • void gameboard(char mark)
  • {
  • if(choice==1)
  • square[1]==mark;
  • else if(choice==2)
  • square{2]=mark;
  • else if(choice==3)
  • square[3]=mark;
  • else if(choice==4)
  • square[4]=mark;
  • else if(choice==5)
  • square[5]=mark
  • else if(choice==6)
  • square[6]=mark;
  • else if(choice==7)
  • square[7]=mark;
  • else if(choice==8)
  • square[8]=mark;
  • else if(choice==9)
  • square[9]=mark;
  • else
  • player- -;
  • getch();
  • }

C PROGRAMMING #3 :LOOPS

Let’s suppose you want the computer to display “www.teachfullstack.com” 10 times.

printf(“www.teachfullstack.com”);

Will you write this line 10 times?

If the sentence is lengthier writing it could be an exhausting task.But programmers look for shorter ways.The shorter the code the better.

Hence instead of writing it 10 times we create a loop inside the compiler after it reaches the specified limit we make it to stop or break out of the loop.

Lets write a programme to do the above task through while loop which is the one of the loops in C.

  • #include<stdio.h>
  • #include<conio.h>
  • void main()
  • {
  • int i=1
  • while(i<=10){
  • printf(“www.teachfullstack.com”);
  • i++;
  • }
  • }

The above code first 2 lines are preprocessor commands.3rd line is the starting of our function.4th line constitutes the starting of function it tells the programmer this is the starting point of this function, if you don’t know what is function scroll down and you will see a post telling about functions.5th line declares a variable I to the value 1. 6th line is a loop which tells the compiler that until i is less than or equal to 10 keep executing the value of I is the number of lines the printf will execute.i++ tells the compiler to increment value by 1 after which the compiler checks if the incremented I is less than or equal to 10.Please see the last bracket is necessary to close the main()

For loop

  • #include<conio.h>
  • #include<stdio.h>
  • void main()
  • {
  • int i=1;
  • for(i;i<=10;i++)
  • {
  • printf(“www.teachfullstack.com”);
  • }
  • }
  • This code gives the same outputJust the syntax is a little bit different.We will learn more about differences later.While doing practical both of these loops will give the same output it depends on you whichever you want to use.

GIVE ME A CUP OF COFFEE

GET ME A CUP OF COFFEE SO I CAN ADD MORE POSTS IN LESS TIME

$2.00

C PROGRAMMING#4 :ARRAYS

Array is a fine oredered collection of finite homogenous data.

DECLARATION OF ARRAY

dataType arrayName[arraysize];

for example

float mark[5];

here we declared array size as 5 meaning it can store 5 different float values.

the compiler will initialize it as

marks[0],marks[1],marks[2] and so on.Compiler always starts from the value 0 and not 1 irrespective of the language.

Lets create a program to print Fibonacci numbers using arrays

#include <stdio.h>

#include<conio.h>

void main()

{

int n,k;

int arr[40];

printf(“Enter ending value”);

scanf(“%d”,&n);

arr[0]=0;

arr[1]=1;

for(i=2;i<n;i++)
arr[i]=arr[i-1]+[i-2];
printf("%d",arr[i]);
}

GIVE ME A CUP OF COFFEE

Give me a cup of coffee so i can publish free articles in shorter time span.

$2.00

C PROGRAMMING #2:MAKE YOUR FIRST C PROGRAMME

This is your first C programme to print hello world.

#include <stdio.h>

#include<conio.h>

void main()

{

printf(“Hello World”);

getch();

//This programme introduces you to printf it is a built in C keyword to display output on the userscreen.Inside printf is a string embedded after which a semicolon has to be placed this instructs the compiler to end or execute the print function//

//The hello world text embedded inside the double strings are known as strings.The programme can input string as he likes.//

//These are comments which start with 2 double slashes and end with double slashes.//

}

Here is a small task for you make a C programme to display well done on the screen and write comments.

We will learn more about C in the next posts.

C PROGRAMMING#1: BASICS

PREPROCESSOR COMMANDS

These are built in C libraries required to be added in your programme.

The main libraries required in every C programme are -stdio and conio written as per syntax-

#include <stdio.h>

#include<conio.h>

WHAT ARE FUNCTIONS?

Functions are a set of instructions which instructs compiler to perform a specific task.

THE MAIN FUNCTION

MAIN FUNCTION WRITTEN as main()

Is the function in C which is detected first by the compiler.

DATATYPES

There are various datatypes in C

Int-It is a keyword for creating database of integer.Integer database is used to store whole numbers.Integer database is for storing whole numbers and constitutes less space.

float-It is the keyword for creating float datatype.float is capable of storing decimal values as well

There are more datatypes as well.We will learn and create our first c programme in the next post.Scroll for more posts.

 

YOU CAN INSTALL VISUAL CODE EDITOR FOR WINDOWS OR TURBO C .MAC USERS CAN INSTALL XCODE IT HAS BUILT IN C,IOS AS WELL AS ANDROID IDE YOU JUST NEED TO INSTALL IT FROM App Store