1 On Windows OS

  • Create your first project on Visual Studio (eg. VS 2010 )
    • An introduction can be found in link
    • Or in link
  • Create your first project on codeblocks
    • The introduction can be found in link
    • Or in link

2 On Mac OS

  • Create your first project on Xcode
  • Open Xcode, and then click on “File”.
    • get the screen screen
  • Click on “next”
    • input your first project name, such as “project1”
    • choose “C” on “Language”, which is defaut. You can choose “C++” if you want to create a c++ project
    • get the screen
  • Click on “next”
    • choose a path for your “project1”, such as “/Applications/C++/pellequation”
    • get the screen
    • and the screen
  • Click on “main.c” under “project1” on the left
    • get the screen
  • Congratulations! you have created your first project named “project1” with “main.c”
  • Start coding

3 main() in .c file

3.1 Examples

  • In .c file, such as “main.c”, we can code main() as follows
  • Example 1

```r #include<stdio.h> int main(){ int a,b; a = 3; b = 4; printf(“a+b=%d”,a+b);

fflush(stdin); getchar(); return 0; } ``` - Example 2

```r #include<stdio.h> int main(int argc, char* argv[]){ int a,b; a = 3; b = 4; printf(“a+b=%d”,a+b);

fflush(stdin); getchar(); return 0; } ``` - Example 3

```r #include<stdio.h> main(int argc, char* argv[]){ int a,b; a = 3; b = 4; printf(“a+b=%d”,a+b);

fflush(stdin); getchar(); } ``` - Example 4

```r #include<stdio.h> main(){ int a,b; a = 3; b = 4; printf(“a+b=%d”,a+b);

fflush(stdin); getchar(); } ```

3.2 In the final examination, please use Exmple 1 only

  • Some lines can be deleted
  • “#include<stdio.h>” can be deleted if you have no input and output
  • “fflush(stdin);” can be deleted if you have no input, such as “scanf(”Input a = %d“,&a);
  • “getchar();” can be deleted if you do not want to see results on screen, or if you use “Start Without Debugging” under the button “Debug”
  • In the final examination, both “fflush(stdin);” and “getchar();” can be ignored
  • Like this

```r #include<stdio.h> int main(){ int a,b; a = 3; b = 4; printf(“a+b=%d”,a+b);

return 0; } ```