anishcana / jovial

SpringAjaxModule
0 stars 0 forks source link

Switch statement #6

Open anishcana opened 3 months ago

anishcana commented 3 months ago

include

include

void processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; break; case 2: std::cout << "You chose option 2."; break; case 3: std::cout << "You chose option 3."; break; default: std::cout << "Invalid choice."; } }

int main() { std::uint8_t choice; std::cout << "Enter a number (1-3): "; std::cin >> choice;

processChoice(choice);

return 0;

}

anishcana commented 3 months ago

include

include

int processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; return 1; case 2: std::cout << "You chose option 2."; return 2; case 3: std::cout << "You chose option 3."; return 3; default: std::cout << "Invalid choice."; return -1; // Indicate invalid choice } }

int main() { std::uint8_t choice; std::cout << "Enter a number (1-3): "; std::cin >> choice;

int selectedOption = processChoice(choice);

if(selectedOption == -1) {
    // Handle invalid choice
    return 1;
}

// Do something with the selectedOption if needed

return 0;

}

anishcana commented 3 months ago

include

include

enum class Mode { Mode1, Mode2, Mode3, Invalid };

Mode processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; return Mode::Mode1; case 2: std::cout << "You chose option 2."; return Mode::Mode2; case 3: std::cout << "You chose option 3."; return Mode::Mode3; default: std::cout << "Invalid choice."; return Mode::Invalid; } }

int main() { std::uint8_t choice; std::cout << "Enter a number (1-3): "; std::cin >> choice;

Mode selectedMode = processChoice(choice);

switch(selectedMode) {
    case Mode::Mode1:
        // Do something for Mode 1
        break;
    case Mode::Mode2:
        // Do something for Mode 2
        break;
    case Mode::Mode3:
        // Do something for Mode 3
        break;
    case Mode::Invalid:
        // Handle invalid choice
        return 1;
}

return 0;

}

anishcana commented 3 months ago

include

include

struct ModeState { std::uint8_t state;

// Constructor to initialize state
ModeState(std::uint8_t initialState) : state(initialState) {}

// Function to update state
void updateState(std::uint8_t newState) {
    state = newState;
}

};

enum class Mode { Mode1 = 1, Mode2 = 2, Mode3 = 3, Invalid = -1 };

Mode processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; return Mode::Mode1; case 2: std::cout << "You chose option 2."; return Mode::Mode2; case 3: std::cout << "You chose option 3."; return Mode::Mode3; default: std::cout << "Invalid choice."; return Mode::Invalid; } }

int main() { // Define ModeState objects for each mode ModeState mode1State(0b00000001); // Example initial state for Mode 1 ModeState mode2State(0b00000010); // Example initial state for Mode 2 ModeState mode3State(0b00000100); // Example initial state for Mode 3

std::uint8_t choice;
std::cout << "Enter a number (1-3): ";
std::cin >> choice;

Mode selectedMode = processChoice(choice);

switch(selectedMode) {
    case Mode::Mode1:
        // Access and modify state for Mode 1
        mode1State.updateState(0b00001000); // Example state update for Mode 1
        break;
    case Mode::Mode2:
        // Access and modify state for Mode 2
        mode2State.updateState(0b00010000); // Example state update for Mode 2
        break;
    case Mode::Mode3:
        // Access and modify state for Mode 3
        mode3State.updateState(0b00100000); // Example state update for Mode 3
        break;
    case Mode::Invalid:
        std::cout << " Invalid choice.";
        return 1;
}

return 0;

}

anishcana commented 3 months ago

include

include

// Define states for each mode std::uint8_t mode1State = 0b00000001; std::uint8_t mode2State = 0b00000010; std::uint8_t mode3State = 0b00000100;

enum class Mode { Mode1 = 1, Mode2 = 2, Mode3 = 3, Invalid = -1 };

Mode processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; return Mode::Mode1; case 2: std::cout << "You chose option 2."; return Mode::Mode2; case 3: std::cout << "You chose option 3."; return Mode::Mode3; default: std::cout << "Invalid choice."; return Mode::Invalid; } }

int main() { std::uint8_t choice; std::cout << "Enter a number (1-3): "; std::cin >> choice;

Mode selectedMode = processChoice(choice);

switch(selectedMode) {
    case Mode::Mode1:
        // Access and modify state for Mode 1
        mode1State |= 0b00001000; // Example state update for Mode 1
        break;
    case Mode::Mode2:
        // Access and modify state for Mode 2
        mode2State |= 0b00010000; // Example state update for Mode 2
        break;
    case Mode::Mode3:
        // Access and modify state for Mode 3
        mode3State |= 0b00100000; // Example state update for Mode 3
        break;
    case Mode::Invalid:
        std::cout << " Invalid choice.";
        return 1;
}

return 0;

}

anishcana commented 3 months ago

include

include

// Define states for each mode in hexadecimal representation std::uint8_t mode1State = 0x01; std::uint8_t mode2State = 0x02; std::uint8_t mode3State = 0x04;

enum class Mode { Mode1 = 1, Mode2 = 2, Mode3 = 3, Invalid = -1 };

Mode processChoice(std::uint8_t choice) { switch(choice) { case 1: std::cout << "You chose option 1."; return Mode::Mode1; case 2: std::cout << "You chose option 2."; return Mode::Mode2; case 3: std::cout << "You chose option 3."; return Mode::Mode3; default: std::cout << "Invalid choice."; return Mode::Invalid; } }

int main() { std::uint8_t choice; std::cout << "Enter a number (1-3): "; std::cin >> choice;

Mode selectedMode = processChoice(choice);

switch(selectedMode) {
    case Mode::Mode1:
        // Access and modify state for Mode 1
        mode1State |= 0x08; // Example state update for Mode 1
        break;
    case Mode::Mode2:
        // Access and modify state for Mode 2
        mode2State |= 0x10; // Example state update for Mode 2
        break;
    case Mode::Mode3:
        // Access and modify state for Mode 3
        mode3State |= 0x20; // Example state update for Mode 3
        break;
    case Mode::Invalid:
        std::cout << " Invalid choice.";
        return 1;
}

return 0;

}

anishcana commented 3 months ago

import org.apache.poi.ss.usermodel.*;

public class ExcelReader { public static void main(String[] args) { // Assume wb is your Workbook object containing the Excel data Sheet sheet = wb.getSheetAt(0); for (Row row : sheet) { for (Cell cell : row) { if (cell.getCellType() == CellType.ERROR) { if (cell.getErrorCellValue() == FormulaError.NA) { // Handle #N/A error System.out.println("Encountered #N/A error in cell " + cell.getAddress()); } } } } } }

anishcana commented 3 months ago

<!DOCTYPE html>

List of People

List of People

anishcana commented 3 months ago

<!DOCTYPE html>

Get ID from URL Parameter
anishcana commented 3 months ago

<!DOCTYPE html>

Key-Value Pair Table
Key Value
anishcana commented 3 months ago
Key Value
anishcana commented 3 months ago

table id="keyValueTable">

Key Value
<tbody>
    <!-- Table body will be populated dynamically -->
</tbody>

</table

anishcana commented 3 months ago

<!DOCTYPE html>

Clickable Key-Value Pair Table
Key Value
anishcana commented 3 months ago

<!DOCTYPE html>

Clickable Rows Example
Name Age Email
John Doe 30 john@example.com
Jane Smith 25 jane@example.com
anishcana commented 3 months ago

      FROM openjdk:17       VOLUME /tmp       EXPOSE 8080       ARG JAR_FILE=target/com-minikube-0.0.1-SNAPSHOT.jar       ADD ${JAR_FILE} com-minikube-0.0.1-SNAPSHOT.jar       ENTRYPOINT ["java","-jar","/com-minikube-0.0.1-SNAPSHOT.jar"]