Found 34494 Articles for Programming

parse_ini_string() function in PHP

karthikeya Boyini
Updated on 24-Jun-2020 09:25:58

99 Views

The parse_ini_string() function parses a configuration string. The function returns the settings as an associative array on success. It returns FALSE on failure.Syntaxparse_ini_string(file_path, process_sections)Parametersfile_path − The ini file to be parsed.process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.ReturnThe parse_ini_string() function returns the settings as an associative array on success. It returns FALSE on failure.Let’s say the content of our “demo.ini” is −[names] one = Anne [urls] host1 = "https://www.example1.com"ExampleOutputArray ( [one] => Anne [host1] => https://www.example1.com )Read More

glob() function in PHP

Samual Sam
Updated on 24-Jun-2020 08:57:19

2K+ Views

The glob() function returns an array of filenames or directories matching a specified pattern. The glob() function returns.An array containing the matched files/directories, Returns an empty array if no file is matched, FALSE on error.Syntaxglob(pattern, flags)Parameterspattern − The pattern to search for.flags − The following are the flags:GLOB_MARK - Adds a slash to each item returnedGLOB_NOSORT - Return files as they appear in the directory (unsorted)GLOB_NOCHECK - Returns the search pattern if no match were foundGLOB_NOESCAPE - Backslashes do not quote metacharactersGLOB_BRACE - Expands {p, q, r} to match 'p', 'q', or 'r'GLOB_ONLYDIR - Return only directories which match the ... Read More

C++ Program to Concatenate Two Strings

Samual Sam
Updated on 24-Jun-2020 08:14:20

824 Views

A string is a one dimensional character array that is terminated by a null character. Concatenation of two strings is the joining of them to form a new string. For example.String 1: Mangoes are String 2: tasty Concatenation of 2 strings: Mangoes are tastyA program to concatenate two strings is given as follows.Example Live Demo#include using namespace std; int main() {    char str1[100] = "Hi...";    char str2[100] = "How are you";    int i,j;    cout

C++ program to Reverse a Sentence Using Recursion

karthikeya Boyini
Updated on 24-Jun-2020 08:14:54

1K+ Views

A string is a one dimensional character array that is terminated by a null character. The reverse of a string is the same string in opposite order. For example.Original String: Apple is red Reversed String: der si elppAA program that reverses a sentence in the form of a string using recursion is given as follows.Example Live Demo#include using namespace std; void reverse(char *str) {    if(*str == '\0')    return;    else {       reverse(str+1);       cout

C++ Program to convert Octal Number to Decimal and vice-versa

Samual Sam
Updated on 24-Jun-2020 08:17:03

497 Views

In a computer system, the octal number is expressed in the octal numeral system while the decimal number is in the decimal numeral system. The octal number is in base 8 while the decimal number is in base 10.Examples of decimal numbers and their corresponding octal numbers are as follows.Decimal NumberOctal Number10127010625311620A program that converts the octal numbers into decimal and the decimal numbers into octal is as follows −Example Live Demo#include #include using namespace std; void DecimalToOctal(int decimalNum) {    int octalNum = 0, placeValue = 1;    int dNo = decimalNum;    while (decimalNum != 0) {       octalNum += (decimalNum % 8) * placeValue;       decimalNum /= 8;       placeValue *= 10;    } cout

C++ Program to Access Elements of an Array Using Pointer

karthikeya Boyini
Updated on 24-Jun-2020 08:17:53

12K+ Views

Pointers store the memory location or address of variables. In other words, pointers reference a memory location and obtaining the value stored at that memory location is known as dereferencing the pointer.A program that uses pointers to access a single element of an array is given as follows −Example Live Demo#include using namespace std; int main() {    int arr[5] = {5, 2, 9, 4, 1};    int *ptr = &arr[2];    cout

C++ Program to Store Information of a Student in a Structure

Samual Sam
Updated on 24-Jun-2020 08:18:52

5K+ Views

A structure is a collection of items of different data types. It is very useful in creating complex data structures with different data type records. A structure is defined with the struct keyword.An example of a structure is as follows.struct employee {    int empID;    char name[50];    float salary; };A program that stores student information in a structure is given as follows.Example Live Demo#include using namespace std; struct student {    int rollNo;    char name[50];    float marks;    char grade; }; int main() {    struct student s = { 12 , "Harry" , 90 , 'A' };    cout

C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String

karthikeya Boyini
Updated on 24-Jun-2020 08:20:17

1K+ Views

A string is a one dimensional character array that is terminated by a null character. There can be many vowels, consonants, digits and white spaces in a string.For example.String: There are 7 colours in the rainbow Vowels: 12 Consonants: 15 Digits: 1 White spaces: 6A program to find the number of vowels, consonants, digits and white spaces in a string is given as follows.Example Live Demo#include using namespace std; int main() {    char str[] = {"Abracadabra 123"};    int vowels, consonants, digits, spaces;    vowels = consonants = digits = spaces = 0;    for(int i = 0; str[i]!='\0'; ... Read More

C++ Program to Find the Length of a String

Samual Sam
Updated on 24-Jun-2020 08:20:42

2K+ Views

A string is a one dimensional character array that is terminated by a null character. The length of a string is the number of characters in the string before the null character.For example.char str[] = “The sky is blue”; Number of characters in the above string = 15A program to find the length of a string is given as follows.Example Live Demo#include using namespace std; int main() {    char str[] = "Apple";    int count = 0;    while (str[count] != '\0')    count++;    cout

C++ Program to Find Transpose of a Matrix

karthikeya Boyini
Updated on 24-Jun-2020 08:21:39

11K+ Views

A matrix is a rectangular array of numbers that is arranged in the form of rows and columns. A transpose of a matrix is a new matrix in which the rows of the original are the columns now and vice versa. For example.A matrix is given below −1 2 3 4 5 6 7 8 9The transpose of the above matrix is as follows.1 4 7 2 5 8 3 6 9A program to find the transpose of a matrix is as follows −Example Live Demo#include

Advertisements