Android Lesson 2:Running your App In the previous lesson [https://developerinsider.co/lesson-1-create-an-android-project/], you created an Android project that displays "Hello World." You can now run the app on a real device or on an emulator. If you don't have a real device available, skip to Run on an Emulator. Run...
Android Lesson 1: Create an Android Project This lesson shows you how to create a new Android project with Android Studio and describes some of the files in the project. In Android Studio, create a new project: If you don't have a project opened, in the Welcome to Android Studio window, click Start a new...
Primary The do..... while loop in C++ The do.... while loop checks its condition at the bottom of the loop. A do.... while loop is similar to a while loop. The one difference is that the do.... while loop is guaranteed to execute at least one time. Syntax: do { statement(s); }while(condition); Example: int a=0;...
Primary The for loop in C++ A for loop is a repetition control structure that allows you to efficiently write a loop that executes a specific number of times. Syntax: for(init;condition;increment ) { statement(s); } The init step is executed first, and does not repeat. Next, the condition is evaluated, and the body of the...
Primary The while loop in C++ Loops: A loop repeatedly executes a set of statements until a particular condition is satisfied. A while loop statement repeatedly executes a target statement as long as a given condition remains true. Syntax: while(condition) { statement(s); } The loop iterates while the condition is true. The loop's body...
Primary Nested if & if/else Statements in C++ Nested if statements: You can also include, or nest, if statements within another if statement. For example: int mark = 100; if (mark >= 50) { cout << "You passed." << endl; if (mark == 100) { cout <<"Perfect!" << endl; } } else { cout <<...
Primary Relational operator of C++ Additional relational operators: Operator Description Example == Equal to 4==2 False <= Less than or equal to 4<=2 False >= Greater than or equal to 4>=2 True != Not equal to 4!=2 True Example: if(10==10) { cout<<"Yes"; } Output: Yes The...
Primary If else statement in C++ Else statement: An if statement can be followed by an optional else statement, which executes when the condition is false. Syntax: if(condition) { //statements } else { //statements } The compiler will test the condition: :-If it evaluates to true, then the code inside the if statement will be executed If it evaluates...
Primary If Statement in C++ Decision Making: The if statement is used to execute some code if a condition is true. Syntax: if(condition) { //statements } The condition specifies which expression is to be evaluated. If the condition is true,the statements in curly brackets are executed. If statement: Use relational operators to evaluate conditions. For...
Primary Assignment Operators and Increment Operator of C++ Assignment Operator: The simple assignment operator (=) assigns the right side to left side. C++ provides shorthand operators that have the capability of performing an operation and an assignment at the same time. For example: int x=5; x+=3; //It's mean x=x+3 x-=2; //It'...
Primary Basic Arithmetic of C++ Arithmetic Operators: C++ supports these arithmetic operator. Operator Symbol Form Addition + x+y Subtraction - x-y Multiplication * x*y Division / x/y Modulus % x%y Addition: The addition operator adds its operands together. int x=2+3; cout<<x; Output: 5 Subtraction: The subtraction operator subtracts o...
Primary How to take input by user in C++ User input: To enable the user to to input a value,use cin in combination with the extraction operator (>>). The variable containing the extracted data follows the operator. The following example shows how to accept user input and store it in the num variables. For example: int num;...
Primary Basic programs of C++ Write a program in C++ to print a massage on output screen. #include<iostream> using namespace std; int main() { cout<<"Hello world"; return 0; } Output: Hello world -------------------------------------------------------------------------------- Write a program in C++ to print an integer value. #include<iostream> using namespace...
Primary Variables declaration in C++ Creating a variable reserves a memory location, or a space in memory for storing values. The compiler requires that you provide a data type for each variable you declare. Here some point to remember - * C++ offer a rich assortment of built-in as well as user defined data types. * Integer,...
Primary Comments line in C++ Comments are explanatory statements that you can include in C++ code to explain what the code is doing. The compiler ignores everything that appears in the comment,so none of that information shows in the result. Single-Line Comments: Comments that require lines begin with //. You can place them on the...