Snippets Collections
<script type="text/javascript">
  var onloadCallback = function() {
    alert("grecaptcha is ready!");
  };
</script>
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }

@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }

@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }

@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }

@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }

@media (min-width:1281px) { /* hi-res laptops and desktops */ }
#container {
    position: relative;
}
#inner_item {
    position: absolute;
    bottom: 0;
}
 const add=(...no)=>{
   //three dots are the rest parameter
    let total=0;
    for(let i of no){
        total=total + i;
        
    }
    
    return total;
}
 
  const ans=add(2,2,2,2)
  console.log(ans);
---
title: Node
---
flowchart LR
    id
```
function test() {
  console.log("notice the blank line before this function?");
}
```
```
function test() {
  console.log("notice the blank line before this function?");
}
```
```
function test() {
  console.log("notice the blank line before this function?");
}
```
```
function test() {
  console.log("notice the blank line before this function?");
}
```
```
function test() {
  console.log("notice the blank line before this function?");
}
```
let body = {"requestKey":"requestValue"};
let response = await makeAPIRequest({
  url: `url of the API`,
      method: "Request Method",
      headers: {
          'Authorization': `Bearer api-key`,
          'Content-Type': 'application/json'
      },
      body: body
});
import * as web3 from "@solana/web3.js";

const connection = new web3.Connection(web3.clusterApiUrl("devnet"));

async function main(){
    const key: Uint8Array = Uint8Array.from([PRIVATE KEY del que paga]);
    const signer = web3.Keypair.fromSecretKey(key);
    let programId: web3.PublicKey = new web3.PublicKey("Tu ProgramId");

    let transaction = new web3.Transaction();

    transaction.add (
        new web3.TransactionInstruction({
            keys: [],
            programId,
            data: Buffer.alloc(0)
        })
    )

    await web3
        .sendAndConfirmTransaction(connection, transaction, [signer])
        .then((sig)=> {
            console.log("sig: {}", sig);
        });

}

main();
[dependencies]
	solana-program = "=1.10.2"
[lib]
	crate-type = ["cdylib", "lib"]
use solana_program::{
    account_info:: AccountInfo, entrypoint, entrypoint::ProgramResult, msg, pubkey::Pubkey,

};

entrypoint!(process_instructions);
fn process_instructions(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
) -> ProgramResult{

    msg!("Program id: {}, accounts: {}, instructions: {:?}",
        program_id,
        accounts.len(),
        instruction_data
    );

    Ok(())
}
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
import java.util.*;

public class Main {

    public static void solve(int []arr, int n, int s){
        int size = arr.length;
		boolean ans = false;
		for(int i=0; i<size; i++){
			int sum = 0;
			for(int j=i; j<size; j++){
				sum = sum + arr[j];
				if(n <= size && sum == s){
					ans = true;
					break;
				}
			}
		}
		if(ans){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
		//System.out.println(size);
    }

    public static void main(String[] args) throws Throwable {
        Scanner sc = new Scanner(System.in);
        int []arr={1,2,3,4,5,6,7,8,9,10};
        int n;
        n=sc.nextInt();
        int s;
        s=sc.nextInt();
        solve(arr, n, s);
    }
}

import React from "https://esm.sh/react@18.2.0"
import ReactDom from "https://esm.sh/react-dom@18.2.0/client"
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from multiprocessing import Process
import time

# The main process calls this function to create the driver instance.
def createDriverInstance():
    options = Options()
    options.add_argument('--disable-infobars')
    driver = webdriver.Chrome(chrome_options=options, port=9515)
    return driver

# Called by the second process only.
def secondProcess(executor_url, session_id):
    options = Options()
    options.add_argument("--disable-infobars")
    options.add_argument("--enable-file-cookies")
    capabilities = options.to_capabilities()
    same_driver = webdriver.Remote(command_executor=executor_url, desired_capabilities=capabilities)
    same_driver.close()
    same_driver.session_id = session_id
    same_driver.get("https://www.wikipedia.org")
    time.sleep(4)
    same_driver.quit()

if __name__ == '__main__':
    driver = createDriverInstance()
    driver.get("https://google.com")
    time.sleep(2)

    # Pass the driver session and command_executor to the second process.
    p = Process(target=secondProcess, args=(driver.command_executor._url,driver.session_id))
    p.start()
Project Task Search || All task within SO Start and End Date

https://7315200-sb1.app.netsuite.com/app/common/search/search.nl?cu=T&e=T&id=1180

var projecttaskSearchObj = search.create({
   type: "projecttask",
   filters:
   [
      ["project","anyof","87521"], 
      "AND", 
      ["startdate","onorafter","01/01/2023"], 
      "AND", 
      ["custevent_clb_taskenddate","onorbefore","12/31/2023"]
   ],
   columns:
   [
      search.createColumn({
         name: "id",
         sort: search.Sort.ASC,
         label: "ID"
      }),
     
     
     
//there is a function in an external app, fetching data rather than ID
var = pod_planner1.Planner2externalApps.FetchDevMap(input.Development_Property);
devname = var.get("devname");
import moment from 'moment';

const expiryDate = '03-21-2023';
const currentDate = moment();

// Parse the expiry date using Moment.js
const parsedExpiryDate = moment(expiryDate, 'MM-DD-YYYY');

// Compare the expiry date to the current date to check if the token is expired
if (parsedExpiryDate.isBefore(currentDate)) {
  console.log('Token has expired!');
} else {
  console.log('Token is still valid');
}
function past(h, m, s){
  return s*1000 + m*60000 + h*3600000
}
function paperwork(n, m) {
  if (n < 0  || m < 0) {
return 0
  } else {
    return n * m 
  }
}
import React from "react"
import ContentLoader from "react-content-loader"

const MyLoader = (props) => (
  <ContentLoader 
    speed={2}
    width={210}
    height={260}
    viewBox="0 0 210 260"
    backgroundColor="#f3f3f3"
    foregroundColor="#ecebeb"
    {...props}
  >
    <circle cx="162" cy="112" r="49" />
  </ContentLoader>
)

export default MyLoader

int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}


void forward() {
  digitalWrite(motor1pin1,HIGH);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,LOW);
  digitalWrite(motor2pin2,HIGH); 
  delay(1000); 
}

void pause() {
  digitalWrite(motor1pin1,LOW);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,LOW);
  digitalWrite(motor2pin2,LOW); 
  delay(1000); 
}


void loop() {
  // put your main code here, to run repeatedly:
  forward();
  pause();
  
}
int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(motor1pin1,LOW);
  digitalWrite(motor2pin1,HIGH);

  digitalWrite(motor1pin2,LOW);
  digitalWrite(motor2pin2,HIGH);  
 
}
int motor1pin1 = 2;
int motor1pin2 = 3;

int motor2pin1 = 4;
int motor2pin2 = 5;


void setup() {
  // put your setup code here, to run once:
  pinMode(motor1pin1,OUTPUT);
  pinMode(motor1pin2,OUTPUT);
  pinMode(motor2pin1,OUTPUT);
  pinMode(motor2pin2,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(motor1pin1,HIGH);
  digitalWrite(motor1pin2,LOW);

  digitalWrite(motor2pin1,HIGH);
  digitalWrite(motor2pin2,LOW);  
 
}
#include <iostream>
using namespace std;

template <class T>
class Arithmetic
{
private :
    T a;
    T b;
public :
    Arithmetic(T a,T b);
    T add();
    T sub();
};

template<class T>
Arithmetic<T>::Arithmetic(T a,T b)
{
    this->a =a;
    this->b =b;
}

template <class T>
T Arithmetic<T>:: add()
{
    T c;
    c = a+b;
    return c;
}

template <class T>
T Arithmetic<T>:: sub()
{
    T c;
    c = a-b;
    return c;
}

int main() 
{
    Arithmetic<int> ar(10,5);
    cout<<ar.add()<<endl;
    cout<<ar.sub()<<endl;
    
    Arithmetic<float> ar1(1.22,1.3);
    cout<<ar1.add()<<endl;
    cout<<ar1.sub()<<endl;
    
    return 0;
}
  static userTimezoneToSpecifiedTimeZone(date: Date, time: string, timeZone: string): Date {
    // Major timeZone's for Australia and their offset values in hours
    // NOTE Darwin etc -> I'm not sure 9.5 or 10.5 will work
    const DST_OFFSETS = {
      'Australia/Sydney': [11, 10],
      'Australia/Brisbane': [11, 10],
      'Australia/Melbourne': [11, 10],
      'Australia/Canberra': [11, 10],
      'Australia/Darwin': [10.5, 9.5],
      'Australia/Adelaide': [10.5, 9.5],
      'Australia/BrokenHill': [10.5, 9.5],
      'Australia/Perth': [9, 8]
    };

    // Calculate the offset depending on if the date is in is DST or not
    const [dstStartOffset, dstEndOffset] = DST_OFFSETS[timeZone];
    const daylightSavingOffset = this.isDaylightSavingTime(date, timeZone) ? dstStartOffset : dstEndOffset;

    const hoursAndMinutes = time.split(':');

    // Collect raw values to create date object
    let year = date.getFullYear();
    let month = date.getMonth();
    let day = date.getDate();
    let hours = Number(hoursAndMinutes[0]);
    const minutes = Number(hoursAndMinutes[1]);

    // We then convert these values to the timezone's UTC by adding the offset
    // i.e. Sydney is 10/11 hours ahead of GMT, so we need to minus 10/11 hours to get GMT.
    // allow for the GMT being the day, month and year before when subtracting the offset.
    if ((hours - daylightSavingOffset) < 0) {
      hours = 24 + (hours - daylightSavingOffset);
      day--;
      if ((month - 1) < 0) {
        year  = year--;
        month = 11;
      }
    } else {
      hours = hours - daylightSavingOffset;
    }
    
    // Create the date object using the UTC value we created above.
    const returnDate = new Date(Date.UTC(year, month, day, hours, minutes, 0));

    // console.log(`${timeZone} Timezone from FormHelper-> ` + returnDate.toLocaleString(undefined, {timeZone: timeZone}))

    return returnDate;
    
   }

   static isDaylightSavingTime(date: Date, timeZone: string): boolean {
    // Get the time zone offset for the specified date
    const offset = new Date(date.toLocaleString('en-US', { timeZone })).getTimezoneOffset();
  
    // Calculate the daylight saving time start and end dates for the current year
    const year = date.getFullYear();
    const dstStart = new Date(Date.UTC(year, 9, 1, 16)).toLocaleString('en-US', { timeZone });
    const dstEnd = new Date(Date.UTC(year, 3, 1, 16)).toLocaleString('en-US', { timeZone });
  
    // Determine if the specified date falls within the daylight saving time period
    return offset < new Date(dstEnd).getTimezoneOffset() && offset >= new Date(dstStart).getTimezoneOffset();
  }
  
using System;
class Demo {
   public static void Main(){
      Double val1 = 30.40;
      Double val2 = Double.MinValue;
      Double val3 = Double.MaxValue;
      Console.WriteLine("Absolute value of {0} : {1}", val1, Math.Abs(val1));
      Console.WriteLine("Absolute value of {0} : {1}", val2, Math.Abs(val2));
      Console.WriteLine("Absolute value of {0} : {1}", val3, Math.Abs(val3));
   }
}
SELECT Id, Name, CreatedById, CreatedDate, CEC_Created_By__c, LastModifiedDate, LastModifiedById, cg__Case__c, cg__Content_Type__c, cg__Description__c, cg__File_Name__c, cg__File_Size__c, cg__File_Size_in_Bytes__c, CEC_SendNotification__c, cg__Sync_Id__c, cg__Private__c, cg__WIP__c, cg__Version_Id__c, CEC_Upload_Complete_Timestamp__c, CEC_Event_Notification_Record__c FROM cg__CaseFile__c ORDER BY SystemModStamp DESC LIMIT 10
flutter build apk - obfuscate - split-debug-info=/<project-name>/<directory>
const store=()=>{
    console.log("below we can describe a nested function")
    
    let s1=()=>{
        console.log("s1 is inside function ,and we can call this function inside this functon");
    }
    s1();
}


store();
package database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class OracleConnection{

    public static Connection getConnection()
    {
         Connection myConnection = null;
         String userName, password, service, url;

         userName = "vehiculefleetdb" ;
         password = "123" ;
         service = "localhost" ;

         url = "jdbc:oracle:thin:";

        try {

                myConnection = DriverManager.getConnection(url + userName + "/" + password + "@" + service);
                 System.out.println(" Connection successfull");

        } catch (SQLException ex) {
              ex.printStackTrace();
                  System.out.println(" Connection failed  ");
        }

        return myConnection;
    }


}
package bus ;

import java.io.Serializable;

public class Vehicule implements IMileageEfficiency, Serializable{


	private static final long serialVersionUID = 1L;
	double ME;
	double serialNumber;
	String made;
	String model;
	String color;
	int lenghtInFeet;
	protected int tripCounter;
	double energyConsumed;
	String eSuffix;

	Vehicule(double serialNumber, String made, String model, String color,
			 int lenghtInFeet, int tripCounter, String eSuffix){
		ME = 0;
		this.tripCounter = tripCounter;
		energyConsumed = 0;
		this.serialNumber = serialNumber;
		this.made = made;
		this.model = model;
		this.color = color;
		this.lenghtInFeet = lenghtInFeet;
		this.eSuffix = eSuffix;
		
	};
	
	public double getSN() {
		return this.serialNumber;
	}
	
	public double getMilePerUnitOfEnergy() {
		if (energyConsumed == 0) {
			return 0;
		}else {
		ME = this.tripCounter/this.energyConsumed;
		return ME;
		}
	}
	
	public void makeTrip(int tripCounter, double energyConsumed) {
		this.energyConsumed = energyConsumed;
		this.tripCounter = tripCounter;
		
	}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RPG_Game.Classes
{
    public static class GameManager
    {
        public static List<Player> ListPlayers = new List<Player>();
        public static Player CurrentPlayer;
        public static bool gameOver = false;
        private static int BattleRounds = 0;
        private static int MaxRounds = 5;
        
        public static void StartGame(string name)
        {
            try
            {
                GameManager.ListPlayers = DataXML.Load("HighScores.xml");
            }catch(Exception e) {
                Console.WriteLine("Exception error : "+e.Message);
            }
            
            Player player = Search_Player(name);
            //Player is loaded from the file 
            if(player != null)
            {
                if (player.IsDead())
                {
                    CurrentPlayer = new Player(name, 100);
                }
                else
                {
                    CurrentPlayer = player;
                }
            }
            else   //Player is not found
            {
                CurrentPlayer = new Player(name, 100);
            }            
        }
        //-------------------------------------------------------------------------------
        public static Player Search_Player(string name)
        {
            foreach (Player player in ListPlayers)
            {
                if (String.Compare(player.Name, name, true) == 0)
                {
                    return player;
                }
            }
            return null;
        }
        //-----------------------------------------------------------------------------
        public static void GameOver()
        {
            gameOver = true;
            Console.WriteLine("Game Over !");
        }
        public static void SaveGame()
        {
            CurrentPlayer.Enemy = null;
            Player player = Search_Player(CurrentPlayer.Name);
            //Player is found
            if (player != null)
            {
                if (player.GP < CurrentPlayer.GP)
                {
                    ListPlayers.Remove(player);// remove the existing player with lower score
                    ListPlayers.Add(CurrentPlayer);//save the player of highest score in List
                }
            }
            else   //Player is not found
            {
                ListPlayers.Add(CurrentPlayer);//save the player in List
            }
            //Save the List in XML file
            DataXML.Save("HighScores.xml", GameManager.ListPlayers);
        }
        //--------------------------------------------------------------------------------------------
        public static void StartBattle()
        {
            Console.WriteLine("You are triying to kill the enemy " + GameManager.CurrentPlayer.Enemy.Name);
            GameManager.CurrentPlayer.Attack();
            BattleRounds++;

            System.Threading.Thread.Sleep(1000);//wait for one second

            if (GameManager.CurrentPlayer.Enemy != null &&
                GameManager.CurrentPlayer.Enemy.IsDead())
            {
                Message.Danger("\nYour enemy is dead !");
                BattleRounds = 0;
                GameManager.CurrentPlayer.Enemy = null;
                GameManager.Explore();
            }
            else
            {
                Message.Danger("\nYour enemy is not dead !");

                if (BattleRounds >= MaxRounds)
                {
                    Message.Danger("\nYou panic and run away ....");
                    GameManager.CurrentPlayer.Enemy = null;
                    BattleRounds = 0;
                    GameManager.Explore();
                }
                else
                {
                    //The enemy attack the player
                    if (GameManager.CurrentPlayer.Enemy != null)
                    {
                        GameManager.CurrentPlayer.Enemy.Attack();
                        Message.Danger("\n" + GameManager.CurrentPlayer.Enemy.Name + " is attacking you ...");
                    }
                }
            }
        }      
        //------------------------------------------------------------------------------------------
        public static void Explore()
        {
            RNG dice = RNG.GetInstance();
            int random = dice.Next(0, 15);
            Console.WriteLine("\nYou are exploring ...");
            switch (random)
            {
                case 0:
                case 1:
                case 2:
                case 3:
                    Monster monster = GameFactory.CreateMonster();
                    Message.Danger(monster.Name + " approches ! Prepare for battle !");
                    //monster.SetTarget(GameManager.CurrentPlayer);
                    monster.Target = GameManager.CurrentPlayer;
                    GameManager.CurrentPlayer.Enemy = monster;
                    break;

                case 4:
                    Power magic_potion = GameFactory.CreateHealing();
                    Message.Warning("\nYou collect a Magic Potion !");
                    GameManager.CurrentPlayer.AddPower(magic_potion);
                    break;

                case 5:
                    Message.Warning("\nYou collect a Magic Cape !");
                    Power magic_cape = GameFactory.CreateInvisible();
                    GameManager.CurrentPlayer.AddPower(magic_cape);
                    break;
                case 6:
                    Message.Warning("\nYou collect a Wood Shield !");
                    Power shield = GameFactory.CreateProtect();
                    GameManager.CurrentPlayer.AddPower(shield);
                    break;
                case 7:
                    Message.Warning("\nYou collect a Sleepy Dust !");
                    Power magic_powder = GameFactory.CreateSleepy();
                    GameManager.CurrentPlayer.AddPower(magic_powder);
                    break;
                case 8:
                    Message.Warning("\nYou find a Big Rock !");
                    Weapon rock = GameFactory.CreateRock();
                    GameManager.CurrentPlayer.UpdateWeapon(rock);
                    break;

                case 9:
                    Message.Warning("\nYou find a Torch !");
                    Weapon torch = GameFactory.CreateTorch();
                    GameManager.CurrentPlayer.UpdateWeapon(torch);
                    break;
               
                case 10:
                    Message.Warning("\nYou find a Magic Sword !");
                    Weapon sword = GameFactory.CreateSword();
                    GameManager.CurrentPlayer.UpdateWeapon(sword);
                    break;
                case 11:
                    //Number of Gold Pieces is Random between 20 and 99
                    int random_gp = RNG.GetInstance().Next(50, 500);
                    Message.Warning("\nYou collect " + random_gp + " Gold Pieces !");
                    GameManager.CurrentPlayer.GP += random_gp;
                    break;
                default:
                    Console.WriteLine("\nYou are looking for gold pieces !");
                    break;
            }
        }
        
        
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using System.Xml;
using System.Xml.Serialization;

namespace RPG_Game.Classes
{
    public static class DataXML
    {
        public static string path = @..\..\Data\;

        public static void Save(string file, List<Player> list)
        {
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            using (XmlWriter writer = XmlWriter.Create(path + file, settings))
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(List<Player>));
                xmlSerializer.Serialize(writer, list);
            }
        }
        
        public static List<Player> Load(string file)
        {
            List<Player> data = null;
            using (StreamReader reader = new StreamReader(path + file))
            {
                XmlSerializer xml = new XmlSerializer(typeof(List<Player>));
                data = (List<Player>)xml.Deserialize(reader);
            }
            return data;
        }
    }
}
#include <iostream>;
#include <string>;
#include <random>;
using namespace std;

class Auto
{
public:
    void Start();
    void Accelerate();
    void Break();
    string model;
    string cylinder;

    Auto(string x, string y)
    {
        model = x;
        cylinder = y;
    }
};
void Start()
{
    cout << "Start\n";
}
void Accelerate()
{
    cout << "Accelerate\n";
}
void Break()
{
    cout << "Break\n";
}

int main()
{
    srand(time(NULL));

    int randomAction;
    int randomAuto;
    randomAction = (rand() % 3) + 1;
    randomAuto = (rand() % 3) + 1;

    switch (randomAction)
    {
    case 1:
        Start();
        break;
    case 2:
        Accelerate();
        break;
    case 3:
        Break();
        break;
    }

    Auto auto1("CADILAC", "5");
    Auto auto2("Ferrari", "7");
    Auto auto3("Lamborghini", "9");

    switch (randomAuto)
    {
    case 1:
        cout << "The model is: " << auto1.model << ", and the cylinder is: " << auto1.cylinder << endl;
        break;
    case 2:
        cout << "The model is: " << auto2.model << ", and the cylinder is: " << auto2.cylinder << endl;
        break;
    case 3:
        cout << "The model is: " << auto3.model << ", and the cylinder is: " << auto3.cylinder << endl;
        break;
    }
}
#include <stdlib.h>
#include <string>
#include <iostream>

using namespace std;

class nodes { //objet node
public :
    nodes() {
        next = NULL;
    }
    int element; //element dans la node
    nodes* next; //prochain element
}*front = NULL, *rear=NULL, *n, *temp, *temp1; //initialisation des variables

class circularqueue { //objet de la queue circulaire
public :
    //Fonctions des queues circulaire
    void InsertQueue(); 
    void Delete();
    void SearchQueue();
    void DisplayQueue();
};

//Fonction delete des queues circulaires
void circularqueue::Delete() {
    int x; // element à enlever
    temp = front; // temp devient la position de front
    if (front == NULL) { //Si pas de front (empty)
        cout << "The queue is empty" << endl;
    }
    else {
        if (front == rear) {//si positon de front est la meme que rear (un seul element)
            x = front->element; //x devient la valeur de front
            delete(temp); //enleve l'élément qui est à la position de temp(front)
            front = NULL; //Remet front à null
            rear = NULL;// remet rear à null
        }
        else {
            x = temp->element; //x devient la valeur de front (temp == front)
            front = front->next; //front devient le prochain élément
            rear->next = front; //la position de rear devient la position du prochain de front (rear devient l'ancien front)
            delete(temp); //eneleve l'élement temporaire
        }
        cout << "Element " << x << " has been deleted" << endl;
    }
}
void circularqueue::InsertQueue() {
    n = new nodes[sizeof(nodes)]; //crée un nouvel objet node
    cout << "Enter the element you wish to insert: ";
    cin >> n->element; //entrer l'élément de la nouvelle node
    if (front == NULL) { //si front est null
        front = n; //emplacement de front est maintenant la valeur entrée
    } else
    {
        rear->next = n; //position de rear devient le prochain
    }
    rear = n; //l'emplacement rear devient la valeur entrée
    rear->next = front; //position rear devient le prochain
}

void circularqueue::SearchQueue(){
    int search; // Valeur a chercher dans la queue
    int n = 0; //Compteur

    temp = front; // Valeur temporaire est à front;
    temp1 = NULL; // Autre valeur temp. est nulle

    if (front == NULL) { //Si front na pas d'élément
        cout << "The queue is empty..." << endl;
    }
    else {
        cout << "Enter the element you are searching for: ";
        cin >> search; //Enter l'élément à trouver

        while (temp != temp1) { //Fait pendant que la valeur temp != front
            if (search == temp->element) { //si le search est egal à l'élément de la node
                n++; //ajoute au compteur
                temp = temp->next; //change la valeur du front pour la prochaine valeur
                temp1 = front; //Deuxieme temporaire devient la valeur front
            }
        }
        cout << "The element " << search << " is in the queue " << n << " times." << endl;
    }
    return ;
}

void circularqueue::DisplayQueue() {
    temp = front; //temp devient la position de front
    temp1 = NULL; //deuxieme temp  est NULL
    if (front == NULL) { //si la front est vide
        cout << " The queue is empty..." << endl;
    }
    else { //si c'est pas vide
        cout << "The elements in the queue are: ";
        while (temp != temp1) { //pendant que temp n'est pas temp1 (le tour de la queue n'est pas complétée)
            cout << temp->element << " ";
            temp = temp->next; //temp devient la prochaine position
            temp1 = front; //temp 1 devient le front
        }
    }
 }
void OptionList() {
    cout << "1: Insert in the queue." << endl;
    cout << "2: Delete from the queue." << endl;
    cout << "3: Search the queue." << endl;
    cout << "4: Display the queue." << endl;
}
int main() {
    int opt; //option choisie
    bool whileTrue = true; //bool qui est toujours true pour options

    circularqueue Queue; //crée une nouvel object de circular queue
    
    //choisir un option
    while (whileTrue) {

        OptionList();

        cout << "Enter your desired option: ";
        cin >> opt;

        switch (opt) {
        case 1: Queue.InsertQueue();
            break;
        case 2: Queue.Delete();
            break;
        case 3:Queue.SearchQueue();
            break;
        case 4: Queue.DisplayQueue();
            break;
        }

    }
}
#include <iostream>
using namespace std;

class Rectangle
{
    public :
    int length;
    int breadth;

Rectangle(int l, int b)
{
    length = l;
    breadth = b;
}

int area()
{
    return length*breadth;
}

int perimeter()
{
    int p = 2*(length*breadth);
    return p;
}
};

int main() 
{
    int l,b;
    cout << "Enter length and breadth : ";
    cin >> l >> b;
    Rectangle r(l,b);
    
    int a = r.area();
    cout <<"Area is : "<<a << endl;
    
    int peri = r.perimeter();
    cout <<"perimeter is :"<<peri;

    return 0;
}
#include <iostream>
using namespace std;

struct rectangle
{
    int length;
    int breadth;
};

void initialize(struct rectangle *r, int l, int b)
{
    r->length = l;
    r->breadth = b;
}

int area(rectangle r)
{
    return r.length*r.breadth;
}

int perimeter(rectangle r)
{
    int p = 2*(r.length*r.breadth);
    return p;
}

int main() 
{
    rectangle r={0,0};
    int l,b;
    cout << "Enter length and breadth : ";
    cin >> l >> b;
    initialize(&r,l,b);
    
    int a = area(r);
    cout <<"Area is : "<<a << endl;
    
    int peri = perimeter(r);
    cout <<"perimeter is :"<<peri;

    return 0;
}
}
#include <iostream>
using namespace std;

int area(int length, int breadth)
{
    return length*breadth;
}

int perimeter(int length, int breadth)
{
    int p = 2*(length*breadth);
    return p;
}

int main() 
{
    int length = 0, breadth =0;
    cout << "Enter length and breadth : ";
    cin >> length >> breadth;
    
    int a = area(length,breadth);
    cout <<"Area is : "<<a << endl;
    
    int peri = perimeter(length,breadth);
    cout <<"perimeter is :"<<peri;

    return 0;
}
star

Thu Mar 09 2023 01:09:50 GMT+0000 (Coordinated Universal Time) https://developers.google.com/recaptcha/docs/display

@JeanTubbali #html

star

Thu Mar 09 2023 00:33:01 GMT+0000 (Coordinated Universal Time) https://sqlblog.org/2019/09/12/bad-habits-to-kick-avoiding-the-schema-prefix

@p83arch

star

Wed Mar 08 2023 21:23:45 GMT+0000 (Coordinated Universal Time)

@zaccamp #css

star

Wed Mar 08 2023 21:23:43 GMT+0000 (Coordinated Universal Time) https://www.webdevsplanet.com/post/html-dropdown-select-with-searchbox

@ahmad007

star

Wed Mar 08 2023 21:12:24 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/526035/how-can-i-position-my-div-at-the-bottom-of-its-container

@zaccamp #css

star

Wed Mar 08 2023 19:55:17 GMT+0000 (Coordinated Universal Time) https://mermaid.js.org/syntax/flowchart.html

@gebaby

star

Wed Mar 08 2023 19:51:30 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@gebaby

star

Wed Mar 08 2023 19:51:11 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@gebaby

star

Wed Mar 08 2023 19:50:28 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@gebaby

star

Wed Mar 08 2023 19:50:22 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@gebaby

star

Wed Mar 08 2023 19:50:09 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

@gebaby

star

Wed Mar 08 2023 19:46:32 GMT+0000 (Coordinated Universal Time) https://github.com/dilip-borad/airtable-js-functions

@ThisIsKrystina

star

Wed Mar 08 2023 18:33:02 GMT+0000 (Coordinated Universal Time) https://www.faceit.com/ru/upgrade?trackSourcePage

@decaten

star

Wed Mar 08 2023 18:13:41 GMT+0000 (Coordinated Universal Time)

@luisjdominguezp #typescript

star

Wed Mar 08 2023 17:43:43 GMT+0000 (Coordinated Universal Time)

@luisjdominguezp ##rust

star

Wed Mar 08 2023 17:41:12 GMT+0000 (Coordinated Universal Time)

@luisjdominguezp ##rust

star

Wed Mar 08 2023 15:50:41 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/29955500/code-is-not-working-in-on-the-command-line-for-visual-studio-code-on-os-x-ma

@Gimnath

star

Wed Mar 08 2023 14:28:57 GMT+0000 (Coordinated Universal Time) https://course.acciojob.com/idle?question=08d482fc-3df2-4759-8977-941fa4f78b1f

@irfan199927

star

Wed Mar 08 2023 13:31:29 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@naguilc03

star

Wed Mar 08 2023 12:07:36 GMT+0000 (Coordinated Universal Time) https://codi.link/PGRpdiBpZD0iYXBwIj48L2Rpdj4=%7C%7CaW1wb3J0IFJlYWN0RG9tIGZyb20gImh0dHBzOi8vZXNtLnNoL3JlYWN0LWRvbUAxOC4yLjAvY2xpZW50IgoKCmNvbnN0IGFwcERvbUVsZW1lbnQgPSBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnYXBwJyk7Cgpjb25zdCByb290ID0gUmVhY3REb20uY3JlYXRlUm9vdChhcHBEb21FbGVtZW50KQpyb290LnJlbmRlcigiSG9sYSIp

@Antjrobles #javascript

star

Wed Mar 08 2023 11:58:16 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/49764902/how-to-reuse-a-selenium-browser-session

@ahmed.khamees #python

star

Wed Mar 08 2023 11:56:42 GMT+0000 (Coordinated Universal Time)

@mdfaizi

star

Wed Mar 08 2023 11:38:15 GMT+0000 (Coordinated Universal Time)

@ainel

star

Wed Mar 08 2023 11:10:51 GMT+0000 (Coordinated Universal Time)

@skfaizan2301 #react.js #javascript

star

Wed Mar 08 2023 10:29:59 GMT+0000 (Coordinated Universal Time)

@AlanaBF #javascript

star

Wed Mar 08 2023 10:22:27 GMT+0000 (Coordinated Universal Time)

@AlanaBF #javascript

star

Wed Mar 08 2023 09:31:50 GMT+0000 (Coordinated Universal Time) https://skeletonreact.com/

@kaipaeff

star

Wed Mar 08 2023 08:09:29 GMT+0000 (Coordinated Universal Time)

@russiasila

star

Wed Mar 08 2023 07:31:55 GMT+0000 (Coordinated Universal Time)

@eva_u

star

Wed Mar 08 2023 07:03:33 GMT+0000 (Coordinated Universal Time)

@Jackhihihihihi

star

Wed Mar 08 2023 05:50:17 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Wed Mar 08 2023 03:28:04 GMT+0000 (Coordinated Universal Time)

@JamonJamon #typescript

star

Tue Mar 07 2023 23:55:07 GMT+0000 (Coordinated Universal Time) https://www.tutorialspoint.com/math-abs-method-in-chash

@Hack3rmAn

star

Tue Mar 07 2023 23:44:05 GMT+0000 (Coordinated Universal Time) https://manuales.eikonsys.com/usuarios/como-crear-un-nuevo-usuario

@javicinhio

star

Tue Mar 07 2023 23:37:39 GMT+0000 (Coordinated Universal Time) https://www.reviso.com/es/ayuda/articulo/gestion-de-empresas/

@javicinhio

star

Tue Mar 07 2023 21:38:09 GMT+0000 (Coordinated Universal Time)

@kchan #css

star

Tue Mar 07 2023 21:19:40 GMT+0000 (Coordinated Universal Time) https://medium.com/@ashwinmali32/flutter-performance-optimization-tips-74cf76e0a505

@macdac

star

Tue Mar 07 2023 20:40:56 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/javascript/online-compiler/

@bhushan03

star

Tue Mar 07 2023 18:39:43 GMT+0000 (Coordinated Universal Time)

@Fwedy #java

star

Tue Mar 07 2023 18:28:11 GMT+0000 (Coordinated Universal Time)

@Fwedy #java

star

Tue Mar 07 2023 18:27:28 GMT+0000 (Coordinated Universal Time)

@marceloolima

star

Tue Mar 07 2023 17:23:20 GMT+0000 (Coordinated Universal Time)

@Fwedy #c#

star

Tue Mar 07 2023 17:15:01 GMT+0000 (Coordinated Universal Time)

@Fwedy #c#

star

Tue Mar 07 2023 17:07:27 GMT+0000 (Coordinated Universal Time)

@Fwedy #c++

star

Tue Mar 07 2023 16:58:09 GMT+0000 (Coordinated Universal Time) https://www.geeksforgeeks.org/how-to-convert-char-to-string-in-java/

@mohamed_javid

star

Tue Mar 07 2023 16:30:42 GMT+0000 (Coordinated Universal Time)

@Fwedy #c++

star

Tue Mar 07 2023 15:57:53 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 15:32:57 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

star

Tue Mar 07 2023 15:22:03 GMT+0000 (Coordinated Universal Time)

@saakshi #c++

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension