[Solved] Non-Preemptive priority scheduling

The correct code is: #include <stdlib.h> #include <stdio.h> void main() { int pn = 0; //Processes Number int CPU = 0; //CPU Current time int allTime = 0; // Time neded to finish all processes printf(“Enrer Processes Count: “); scanf(“%d”,&pn); int AT[pn]; int ATt[pn]; int NoP = pn; int PT[pn]; //Processes Time int PP[pn]; //Processes … Read more

[Solved] How make this code shorter and accurate this code is just a basic code how to make it more efficient [closed]

Indentation for the logical if-else block is misplaced.Also no input was taken for height variable. #include<stdio.h> int main(){ float a, pi = 3.14, r, c, d, h; printf(“Program to calculate area of circle and volume of cylinder \n”); printf(“select what you want to find?\n1.Area of circle\n2.Volume of cylinder\n”); scanf(“%f”, &c); if (c == 1) { … Read more

[Solved] Depth first or breadth algorithm in adjacency List [closed]

You can implement adjacency list with vectors like this, it is much easier than using pointers. Check the code, it is also much easier to understand how it works. #include <bits/stdc++.h> using namespace std; vector<int> edges[5]; bool visited[5]; void dfs(int x) { visited[x] = true; for(int i=0; i < edges[x].size(); i++) if(!visited[edges[x][i]]) dfs(edges[x][i]); } int … Read more

[Solved] Show Message Box

Based on your code and the fact that you posted your actual credentials on a public forum, I will assume you just want a synchronous solution and want to show a message box after your (blocking) call to MyServer.Send(); wrap your send in a try/catch block: // The program will attempt to send a message … Read more

[Solved] Calc many value with many arithmetic operators c++ [closed]

Writing a calculator is not an easy task, as there is more involved: Operator Precedence Grouping Evaluating of expressions Operator Precedence Operator precedence is the grouping of operations, such as performing all multiplication and division before addition and subtraction. A calculator program should handle precedence without parenthesis (grouping). Grouping A more advanced calculator will allow … Read more

[Solved] I’m trying to make a very simple hangman program work. The while loop isn’t working [closed]

When the scanf(“%i”, &choice); statement is executed, it puts the integer entered by the user, into the int variable choice. However, it also leaves the newline character in the input buffer causing the user input to get thrown off. When the scanf(“%c\n”, &guess); statement is executed, the next character entered is placed on the input … Read more