diff --git a/README.md b/README.md index 0711d91..b9a64e6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,45 @@ # C-plusplus-programming-for-beginners + +**helloworld.cpp** +================================================================ If you're new to programming, this tutorial will show you how to program from scratch using c++ programming language using a simple example with comprehensive explanations. + +Note: +1. Any line that starts with /* and ends with */ are comments, it doesn't make any changes to your code. Allows the programmer to add a description about the code. It's also called multiline comment. +2. Anything after double forward slash or // to the end of the line is also considered to be a single line comment of the code. + +Line 6 defines the scope of the identifiers used in the program. + +The iostream header file should be included at the beginning of all programs that use input/output statements. + +This code contains only one function, main (). + +Every c++ program must have main() function. + +As usual, execution begins at main() function. + +The statement on line 8 causes the string in quotation marks to be displayed on the screen. + +In c++, every main function should end with a return(0) statement, otherwise a warning or an error can occur. + +**Reading-user-input.cpp** +================================================================================================================================================================================ + + +Now we've got four statements within the main function, these are: + +* Line 4 is used to declare a variable with an integer data type, +* Line 5 to give instructions to the user, +* Line 6 to read input from the user and +* Line 7 to display the user input back to the screen. + +**ifStatement.cpp** +================================================================================================================================================================================ + +* Line 4 and 5 are used to declear and intialize the variable +* Line 6 checks for the condition if the expression given to if statmenet is true, then the if block will be executed, +* Otherwise the else block will be executed +* Note: + else part doesn't take any condition expression like the 'if' + + diff --git a/Reading-user-input.cpp b/Reading-user-input.cpp new file mode 100644 index 0000000..4808749 --- /dev/null +++ b/Reading-user-input.cpp @@ -0,0 +1,9 @@ +#include +using namespace std; +int main() { +int num; +cout << "Please input your age."; // c++ statement. +cin>>num; //reading value from the users. +cout<<"Your age is : "< +#include //header using namespace std; int main() { -cout << "Hello World!"; +cout << "Hello World!"; // c++ statement return 0; -} +} //end of the main function/ program diff --git a/ifStatement.cpp b/ifStatement.cpp new file mode 100644 index 0000000..5df292b --- /dev/null +++ b/ifStatement.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; +int main() { +int a = 3; +int b = 4; +if(a>b){ +cout< pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy