C++ :: Print Out All Task Orderings
Jul 20, 2013
Given N tasks (numbered 1-N) and a series of task restrictions (do task 3 before task 2) print out all possible task orderings.
Example input:
3
3 2
Explanation: there are 3 tasks and task 3 must be done before task 2 (each restriction will have its own line)
Example output:
1 3 2
3 1 2
3 2 1
View 9 Replies
ADVERTISEMENT
Aug 6, 2013
Here is what I am trying to do. I am reading from a socket. On receipt of specific data from the socket I have to start some computation (takes more than 5s). But if there is another input from the socket when the computation is in progress I need to disregard the ongoing computation and start all afresh. I have not come across any method which could suspend the ongoing task in the same context. I have thought of running computation in a separate thread. But I feel there must be some other methods doing it in the same context which I am unaware of. And, is my understanding correct that process would take up the new task only after completing the previous computation (which I do not want).
View 6 Replies
View Related
Jan 20, 2015
how i am using wxDev-c++ and i need to make.Tasks would include: use a class or struct variable, and create a program that can perform the following actions:
1. The data provided by the user to enter the keyboard.
2. The display of the stored data.
3. edit the data.
Example of data: name surname age.
I Try like it,its let me input and save it but how to edit it or i am doing it bad?
#include<iostream>
#include<fstream>
using namespace std;
int main()
[code]....
View 5 Replies
View Related
Feb 27, 2013
I have been asked to create a program to overload a function which should accept and print first one integer and then two integers. Here is the code i have produced so far: [URL] ....
Code:
#include <iostream>
using namespace std;
//Overloading f1 three ways
int f1(int a);
double f1(double a);
long f1(long a);
[Code] .....
I am aware the code should work. my only concern is the error i receive on line 12. I am certain there should be a value in the bracket but i dont know what.
View 11 Replies
View Related
Oct 21, 2014
I am searching for a way/api through which i can get list of Applications as showing by task manager inside Applications tab. Is there any way?
View 3 Replies
View Related
Oct 7, 2014
I want to show all running processes of windows.
my motive is whenever any running process closes/quits whether it be console or window based on windows it notify(s) me or user that some .exe has been closed.
View 1 Replies
View Related
Feb 24, 2014
I am looking a good design pattern that takes a combination of a Observer Design Pattern and Command Design Pattern.
Observer Design Pattern:
Subject - ISystem
ConcreteSubject - "Different Types of Systems"
Observer - INotifier
ConcreteObserver - "Different Types of Notifier's"
Command Design Pattern: Used to create a task. "Different Types of Task" ....
View 4 Replies
View Related
Nov 9, 2013
I am checking out this simple piece of code:
private void button1_Click(object sender, EventArgs e) {
Stopwatch sw = Stopwatch.StartNew();
Task Task1 = Task.Factory.StartNew(() => {
Console.WriteLine("Task1 started in : "+ " "+sw.ElapsedMilliseconds);
Thread.Sleep(4000);
Console.WriteLine("Task1 finished in : " + " " + sw.ElapsedMilliseconds);
}
);
}
and the results are :
Task1 started in : 2 in milliseconds
Task1 finished in : 4015 in milliseconds.
The problem is, that if i count the time with an external device, just like the timer of my watch or my cellphone s,the total time is 4,8 or 4,9 seconds, which i wouldn t expect that to happen.
The first thing i ve thought, is that it takes the ThreadPool about 800msec or 1 sec to create the thread so as to execute this task, but even if it is so, shouldn t the stopwatch count the time precisely?So , why is there a deviation between an external timer and the stopwatch ?
View 1 Replies
View Related
Jun 17, 2014
The following code is an example of how task are created with micro cos III in c. I am trying to figure how to create similliar code in C++. My problem is how do I instantiate objects and how to use member functions to represent task. Within the create task routine the address of function is passed as argument. How do I do this in C++? Will I need more than one class? New to embedded C++.
/*!
* @brief LED Flasher Task
*/
void
led5_task (void * p_arg)
{
OS_ERR err;
(void)p_arg; // NOTE: Silence compiler warning about unused param.
[Code]...
View 2 Replies
View Related
Feb 23, 2015
My use case is this: I have a C# Console application. I would like to run it via the Windows Task Scheduler, and would like it to attempt to run until it succeeds. My problem is that I can't achieve this. How does the Windows Task Scheduler recognize that a program has failed? I tried returning 1 or 32 instead of 0 but that didn't work. One possibility is to have the rerun logic in the C# console application but it feels like there must be a better way.
View 6 Replies
View Related
Dec 19, 2012
Basically the question is to develop an application that allows: Create an application which stores information about people, along with a task list.
The user should be able to Store people's information
Name,
Age,
Telephone number,
Address
-Retrieve information by entering name
- Remove a person's record by entering their name
-Return records for all people, sorted according to an information type other than age
-Enter a task which needs doing, a priority entered for its urgency
-View highest priority task on the list
-User should be able to remove highest priority item on the list
How to develop this application on a console command line interface style or any other style.
View 2 Replies
View Related
Nov 17, 2013
I am making a program where the user enters numbers into an array and then a number,x. The array is sorted, then x is inserted into the appropriate place. I wrote my selection sort
Code:
void Sort(int ary[], int size)
{
int temp;
int smallest;
int current;
int move;
}
[code]....
put it wont print the numbers sorted when I use my print function, just the unsorted numbers.
View 1 Replies
View Related
Sep 1, 2014
is there a to use printf to print certain number of blank spaces, where the number is derived from the output of a function?
for(m=low; m<=high;m++)
{
printf("t=%2d %'f(m)-1's %3c", m, ' ',*);
}
This is suppose to output
t=-3 *
t=-2 *
t=-1
.
.
.
View 2 Replies
View Related
Jun 13, 2014
#include<stdio.h>
#include<conio.h>
void main() {
char p='19';
}
View 2 Replies
View Related
Sep 20, 2013
I have this code that determines the amount of people that can fit on some trains in different train combination scenarios. Here is the code:
#include<stdio.h>
#include<stdlib.h>
int main(void) {
int total_track, max_train_length, num_people, num_trains, tl;
printf("What is the total length of track, in feet?
[Code] ....
I need to now "pick the winner," or the highest value for num_people computed. How would I go about this and why?
View 6 Replies
View Related
Feb 7, 2014
I cant print the characters in the end.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
FILE *arquivo1,*arquivo2,*arquivo3;//files i will open//
char texto;//texto= character i will read.
[Code]...
View 5 Replies
View Related
Sep 6, 2014
I found it incredible that I could not found any working example of simple printing text while I was looking on google.
Somewhere I read I should include (I am not sure if I remember the name right but code::blocks on Windows did not find the header)
Code: #include <stdiostream.h>
so I am trying
Code: #include <stdio.h> and cout << "test"; (error: cout undeclared)
or
Code: #include <stdio.h> and std::cout << "test"; also I tried print("test");
as noted somewhere on Answers. Did not work (error: undefined reference print).
Last try I even got most of links in French. So I hope you'll give me the correct answer. Edit: I found it. I used puts()
View 6 Replies
View Related
Aug 27, 2014
i am using turbo c++ my program is based on maths equations and my final answer is 918 or any 3 digit number only but i don't want 918 to print instead i want only 18 to print. this program gives different output for every different input so i can't just minus 900 from it and get 18. i just want that no matter what 3 digit number is the answer,i just get the 2nd and 3rd digits while printing it and not the first.
the final answer giving equation is:-
f=2914-1996
where f is my answer and its 918
but i want it to print as 18 not 918
View 1 Replies
View Related
Jan 10, 2014
If the graph is found to be cyclic how to print out a cycle??
View 1 Replies
View Related
Jan 27, 2015
I wants to print matrix such that Consider that original matrix look like following
1 2 3
4 5 6
7 8 9
Now I want to print like following
7 8 9
4 5 6
1 2 3
we can use only two for loops.
View 1 Replies
View Related
Aug 13, 2014
I have previous threads asking how to make a list of words that were matched up be printed out into a .css or .txt
Is there anyway to make the words being printed out in CMD after debugging/compiling a script printed out in a .txt/.cpp file instead? CMD only has 300 lines. I need the outcome to be printed out elsewhere so more lines can be posted rather than 300.
View 8 Replies
View Related
Aug 15, 2014
Given three integers, print out the ratio max/min
#include <iostream>
using namespace std;
int main(int x,int y,int z,int max,int min)
[Code].....
My Dev++ App in error
View 1 Replies
View Related
Feb 12, 2014
I have the following code to print a string to the LCD using my PIC32 Starter Kit; I have made this code work with success. I cannot, however, make the LCD print numbers.
#include<p32xxxx.h>
#define LCD_PRT PORTE //LCD DATA PORT
//#define LCD_DDR DDRE//LCD DDR
//#define LCD_PIN PINE//LCD PIN
[Code].....
I want to change the original code as little as possible, don't worry about my header files - they are fine.
View 2 Replies
View Related
Jun 21, 2014
i wrote this piece of code but i am now stuck because i dont know how to print the elements from my class. For example, how can i print the three elements of student s?
#include <iostream>
#include <map>
#include <string>
using namespace std;
[Code].....
View 1 Replies
View Related
Feb 17, 2012
I did write a print function which the user put a number and then it will print out till that number
the output is correct ,, but is code correct ? or it could be better somehow ?
write a function named print_out that print all the whole numbers from 1 to n. test the function by placing it in a program that passes a number n to print_out , where this number is entered from the keyboard . the print_out function should have type void; it does not return a value. the function can be called with a simple statement:
print_out(n);
PHP Code:
# include <iostream>
using namespace std;
void print_out (int x);
int main () {
int n;
cout << " enter a number : ";
[Code] ....
View 2 Replies
View Related
Mar 16, 2013
I have a problem with how to print out all the numbers that the user enters the code looks like this so far:
Code:
#include <iostream>
using namespace std;
int main()
[Code] ....
I want the program to print out all the numbers that the user has entered after the program have said the higest and lowest number is ?. But I do not know how to do this I thought it could be something like this:
Code:
cout << input[0];
//or
cout << input[i];
/*
Because i is the number of how many enters of numbers the user can do*/ But that was totally wrong tried to do another "for loop" in the first for loop but that was meaningless because it can't change anything in the first "for loop".
View 7 Replies
View Related