-
asiyashifa started the topic To check leap year in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main() {
int year;
cout << “Enter a year: “;
cin >> year;// leap year if perfectly divisible by 400
if (year % 400 == 0) {
cout << year << ” is a leap year.”;
}
// not a leap year if divisible by 100
// but not divisible by 400
else if (year % 100 == 0) {
cout << year << “…[Read more] -
asiyashifa started the topic Check whether the number is odd or even in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main() {
int n;cout << “Enter an integer: “;
cin >> n;if ( n % 2 == 0)
cout << n << ” is even.”;
else
cout << n << ” is odd.”;return 0;
} -
asiyashifa started the topic Swap two numbers in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main()
{
int a = 5, b = 10, temp;cout << “Before swapping.” << endl;
cout << “a = ” << a << “, b = ” << b << endl;temp = a;
a = b;
b = temp;cout << “nAfter swapping.” << endl;
cout << “a = ” << a << “, b = ” << b << endl;return…
-
asiyashifa started the topic Find int, float,chart in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main()
{
cout << “Size of char: ” << sizeof(char) << ” byte” << endl;
cout << “Size of int: ” << sizeof(int) << ” bytes” << endl;
cout << “Size of float: ” << sizeof(float) << ” bytes” << endl;
cout << “Size of double: ” << sizeof(double) << ” bytes” << endl;return…
-
asiyashifa started the topic Find qoutiont and remainder in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main()
{
int divisor, dividend, quotient, remainder;cout << “Enter dividend: “;
cin >> dividend;cout << “Enter divisor: “;
cin >> divisor;quotient = dividend / divisor;
remainder = dividend % divisor;cout << “Quotient = ” << quotient << endl;
cout <<…[Read more] -
asiyashifa started the topic Add two numbers in the forum Microsoft Word 6 months, 1 week ago
include <iostream>
using namespace std;int main() {
int first_number, second_number, sum;
cout << “Enter two integers: “;
cin >> first_number >> second_number;// sum of two numbers in stored in variable sumOfTwoNumbers
sum = first_number + second_number;// prints sum
cout << first_number << ” + ” << second_number << ” =…[Read more] -
asiyashifa started the topic Printing a number in the forum Microsoft Word 6 months, 1 week ago
#include <iostream>
using namespace std;int main() {
int number;cout << “Enter an integer: “;
cin >> number;cout << “You entered ” << number;
return 0;
} -
asiyashifa started the topic coding for Hello world in the forum Microsoft Word 6 months, 1 week ago
// Your First C++ Program
#include <iostream>
int main() {
std::cout << “Hello World!”;
return 0;
} -
asiyashifa wrote a new item 6 months, 1 week ago
start using C++, you need two things: A text editor, like Notepad, to write C++ code. A compiler, like GCC, to translate the C++ code into a language that the computer will understand.
-
asiyashifa wrote a new item 6 months, 1 week ago
C++, you can exit a program in these ways: Call the exit function. Call the abort function. Execute a return statement from main
-
asiyashifa wrote a new item 6 months, 1 week ago
Top C++ Features Simple. We expect to understand a new programming language thoroughly when we start using it. … Object Oriented. C++ is an Object-Oriented Programming Language (OOP). … Machine […]
-
asiyashifa wrote a new item 6 months, 1 week ago
Names can contain letters, digits and underscores. Names must begin with a letter or an underscore (_) Names are case sensitive ( myVar and myvar are different variables) Names cannot contain whitespaces […]
-
asiyashifa wrote a new item 6 months, 1 week ago
Keywords are those words whose meaning is already defined by Compiler. These keywords cannot be used as an identifier. Note that keywords are the collection of reserved words and predefined identifiers.
-
asiyashifa wrote a new item 6 months, 1 week ago
C++ allows the char, int, and double data types to have modifiers preceding them. A modifier is used to alter the meaning of the base type so that it more precisely fits the needs of various situations. The […]
-
asiyashifa wrote a new item 6 months, 1 week ago
Arithmetic Operators. Assignment Operators. Relational Operators. Logical Operators. Bitwise Operators. Other Operators.
-
asiyashifa started the topic Example for modifier in c++ in the forum C++ 6 months, 1 week ago
Example: char ch = ‘A’; Integer : Integer data type is used to store a value of numeric type. Keyword int is used to declare variables of integer type. Memory size of a variable of integer data type is dependent on Operating System.
-
asiyashifa started the topic Fundamental types in c++ in the forum C++ 6 months, 1 week ago
C++ Fundamental Data Types
Data Type Meaning Size (in Bytes)
int Integer 2 or 4
float Floating-point 4
double Double Floating-point 8
char Character 1 -
asiyashifa started the topic Arguments in c++ in the forum C++ 6 months, 1 week ago
An argument in C++ is the value that is passed to a function whenever that specific function is called. Furthermore, a parameter is specified inside a parenthesis () right after the function name. We can add as many parameter values as we wish to inside a function
-
asiyashifa started the topic Log() in c++ in the forum C++ 6 months, 1 week ago
The log() function in C++ returns the natural logarithm (base-e logarithm) of the argument. This function is defined in <cmath> header file. [Mathematics] logex = log(x) [In C++ Programming]
-
asiyashifa started the topic Closing a file in c++ in the forum C++ 6 months, 1 week ago
Closing a file in C++
Whenever the C++ program comes to an end, it clears the allocated memory, and it closes the file. We can perform the task with the help of close() function. - Load More