How i learn C/C++ or python...etc

in #code6 years ago (edited)

Step 0 (download something you can make compile your code )

Example:Code Blocks.Eclipse......etc

(if you are new,then try most people recommend after you feel you are upper the level then you try and choose what you really want)

Step 1 (build confidence)

Know how to show a simple result.
It would like this.

#include "stdio.h"
#include "stdlib.h"

int main(){
    printf("Hello steemit");
    //then keep try
    printf("this is eight %d",8);
    return 0;
}

Find a thing you can count by a template.
For example "a+b=c" If i have 'a' and 'b' then i will get 'c'.

#include "stdio.h"
#include "stdlib.h"

int main(){
    int a=1;
    int b=3;
    int c=0;
    c=a+b;
    printf("a+b=%d",c);
    return 0;
}

Okay that sound too easy,but easy make you have the confidence to try the next.
Make your code can repeat the method(I mean learn how the function works)

#include "stdio.h"
#include "stdlib.h"
int Add_A_B(int a,int b){
    return a+b;
}
int main(){
    int a=1;
    int b=3;
    printf("a+b=%d\n",Add_A_B(a,b));
    //now keep try
    printf("5+7=%d\n",Add_A_B(5,7));
    printf("8+2=%d\n",Add_A_B(8,2));
    return 0;
}

Now you have enough confidence.
Try something you don't want to count by your pen and paper.
For example:count average of a1.a2.a3.....an

In your brain or paper write what it look like in math
(a1+a2+....+an)/n ,Ok it like this
Then think what you have already
In this case you know a1...an and n
What the next? Try what you write on paper.

#include "stdio.h"
#include "stdlib.h"
float Average(int* array_input,int array_length){
    float result=0;
    int i;
    for(i=0;i<array_length;i++){
        result+=array_input[i];
    }
    return result/array_length;
}
int main(){
    int a[10];//If you step by step will want to know how to save the result 
            //then you will find you need some thing call "array". google it no matter you are learning python or something 
    int i;
    for(i=0;i<10;i++){//You want more auto in code then you will need something call "loop"
        scanf(" %d",&(a[i]));//Always have a idea about input something as i need. same google "how to input in xxx" xxx is what language you are learning,like c.c++.python 
    }
    //now i guess you had learned a lot from google. 
    //combine what you learned.
    printf("Average is %f",Average(a,10));
    
    return 0;
}

Result like
<<< Process finished. (Exit code 0)
new 3.exe
Process started >>>
2
3
5
4
8
9
10
5
4
3
Average is 5.300000<<< Process finished. (Exit code 0)

Step 2 (learn more basic then gui/ui/ux)

In this Step i can't easy to explain
But most important is use the resource you have(like Book.OpenCourse.Forum....what you can image)

*Step 3 (learn algorithm)

This is the Universal idea,if you learn it on c/c++ then you can easy use it on python or others too.
You know the question you have,then you try and learned.
Face the question,spend the time,then grow up.(It always works to me)

Thank you for watching.
I will post more in the future.

Sort:  

Congratulations @lidyon.sym! You received a personal award!

1 Year on Steemit

Click here to view your Board

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

Congratulations @lidyon.sym! 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.15
TRX 0.12
JST 0.025
BTC 55258.26
ETH 2459.89
USDT 1.00
SBD 2.19