C++ :: Traffic Control Program - Output Data At Specific Time
Oct 24, 2013
I was given an assignment to create a simple program for traffic control. How should i output data at a specific time, for e.g a driver approaches an intersection, the yellow light will flash indicating that he needs to slow down and then the red light to stop before taking a route. is there any function i can use to output red light a few seconds after yellow light.
View 10 Replies
ADVERTISEMENT
Jan 6, 2015
I am working on an assignment to enter a number and print all the prime factors of that number. I have that working, but the assignment demands the output be formatted in a strange way which I can't figure out. For example, in my current program entering 10 gets me 25, which is actually 2 and 5. But it should get me: ( 2 * 5 ) but I can't figure out how to do this. On the chance you need it, my code is below:
Code:
#include <iostream>
using namespace std;
int main( )
{
cout << "Number: ";
[Code].....
View 12 Replies
View Related
Feb 13, 2013
I am suppose to make a program that will output a line for a specific age group,but everytime I execute the exe file it gives me the desired line and also the last line included everytime.Where did I go wrong with it including the last line everytime?
#include <iostream>
using namespace std;
int main() {
double age;
cout<<"Enter your age:";
cin>>age;
if (0<age && age <6)
[Code] ......
View 1 Replies
View Related
Jun 12, 2013
I need to know how can i extract control points from a specific character. (this case is it possible?). So, more specifically, i have a specific character, let 'a' this character. So what i need, is how to extract control points from this character in order to draw it as a bezier curve.
View 3 Replies
View Related
Jul 25, 2012
How to display a message only for 10s using timer in c ....
View 1 Replies
View Related
Feb 12, 2015
I am doing Attendance form in my project. So, I want to know that how to add TimeSelector control into Columns of the Gridview.
View 4 Replies
View Related
Mar 2, 2014
// this program gives random number output
#include <iostream>
#include <cstdlib>// contains function protype for rand
#include <iomanip>// for setw
using namespace std;
[code]....
what is the effect on output of program of different numbers input to the int data type named seed*/
View 1 Replies
View Related
Feb 3, 2015
I want to build a proxy, middleman between various client programs on my machine and servers outside, like this:
Client -> Proxy -> Server, Client <- Proxy <- Server.
OSes are Windows XP, 7 and 8.
Within that proxy I want to analyze data before it reaches it's destination and have full control over it to the point where I can prevent a packet from reaching it's destination if my program finds something suspisious going on. I need incoming and outgoing traffic of specific adresses and ports to be forwarded into my application on my client machine. My app then should deliver packets to their destination after they were analyzed.
The parts where data is received, analyzed, manipulated if needed, and sent is something I could code with no difficulty. But the concept of redirecting and forwarding is hard for me to grasp at the moment. I'd like to know at least what winsock functions I have to use.
If it's possible, I would like to use Windows libraries only, nothing from 3rd parties.
View 3 Replies
View Related
Apr 25, 2013
I have to output a series of data, I have to control the width of parts of my data. like following:
double a[] = {1.0, 2.0, 3.0};
double b[] = {1.5, 2.5, 3.5};
ofsteam myfile("result.txt");
for(int i=0; i<3; i++) {
myfile.width(5);
myfile << i+1 << " : " << a[i] << " - " << b[i] << end;
}
I only want to fix the width of a[i], b[i], but let the rest to be output normally.
how I can make it?
View 5 Replies
View Related
May 29, 2014
I am working on a MFC application that I used for Image Analysis. I have a FrameWnd called MillChart that I use to generate an Image. This window is displayed at the run time in the application and not a part of the GUI dialog. It automatically resizes according to the different monitor resolutions and because of this there is a lot of empty space to the right of the MillChart. I was planning to add a picture control in the GUI dialog and redirect whatever is displayed in the MillChart to the Picture Control so that I can place my other elements (checkboxes, scrollbars etc) that I use in my app close to this MillChart and also set the size of the MillChart to a constant size.
Here is the code for positioning the elements (Note: I have only shown the MillChart position)
Code:
void CMainFrame::PositionElements()
{
CRect r, r2, r3;
GetClientRect(&r);
int mcs = r.Height() - r2.Height();
mMillChart->MoveWindow(r.right - r2.Width(),r.top + r2.Height(),mcs,mcs);
[Code] .....
View 1 Replies
View Related
Dec 13, 2014
I created a program that will create a file and print a list on it. Here is the code for my program:
Code:
int controlvalue(void) {FILE *controlvalue;
controlvalue = fopen("something.txt", "a+");
/* Series of fprintfs */
fclose (controlvalue);
return 1;}
Here is an example list created by my program:
Code:
[Gifts]Candy=45
Chocolate=32
Toy=128
Robot=754
Doll=1492
Star=21
Phone=72
Skateboard=87
Frame=314
Days=365
Perfume=421
I want to get the value of "Skateboard" on file. So I need to read 9 lines. On the 9th line, the gets() loop will stop. But, what if I only want to get the value of "Skateboard" as integer (87) and not a string? Also, is it possible to scan the value of Skateboard if it's located on a different (or unknown) line?
View 1 Replies
View Related
Mar 17, 2013
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 200
[Code] ....
Inside of my studentinfo.txt file
Code:
Jnh Has 2353325 23 56 72 34 67 22 46 42 5 23 56 23
Daniel Laurent 6744590 10 20 30 40 50 60 70 80 90 100 40 50
This code is working totally fine. Right now, I'm trying to update a specific data from the student info. Let's say I'm trying to update my student number of Daniel. So, in this case, I want to replace 6744590 to some other student number. I think I have to use fseek() or rewind() and use fputs() but, I don't know how I should decide where to look.
View 8 Replies
View Related
May 4, 2015
I can access a physical device to read a specific sector in a USB hard drive. But my question is how can I Write to a specific sector? Lets say I want to replace what is in a specific sector of a hard drive with a new data.
View 6 Replies
View Related
Apr 1, 2014
(C#, visual studio 2010, Windows Forms Application)
Ive set up one form that has two labels at the top (Western, Eastern). Below that I have a tabcontrol that contains two tabs (Sales, Products)
I have added four user controls:
WesternSales
WesternProducts
EasternSales
EasternProducts
The idea is that when you click on one of the labels (Western or Eastern) you access the tabs relevant to that region.
So, If i click on the "Western" label and then the "Sales" tab, the program loads the WesternSales usercontrol into the Sales tab. Likewise, if I click on the Eastern label and then the Sales Tab, the program loads the EasternSales usercontrol into the Sales tab, etc.
I want to eliminate the need for multiple data adapters. How can I load data from our database into each of the respective usercontrols using one data adapter?
View 2 Replies
View Related
Mar 4, 2014
Alright, so to better myself with network logic I've decided to make a small net game.
I need to input commands to the console as well as output status updates at the same time. I'd prefer to write a gui interface for that, but I'd rather work with WinAPI as little as possible (I mean, look at the way it's designed...).
I'd like to do this with standard operations, limiting dependencies is a must for me.
View 6 Replies
View Related
Nov 28, 2014
I'm making a binary file that has 100 "empty spaces", and then I want to rewrite specific place with info, however it always writes the info at the end of the file, no matter what I try to get position before I call write() it tells me correct position...
#include <Windows.h>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
[Code].....
View 5 Replies
View Related
Jan 31, 2015
I created a dataset that contains an empty dataTable that has several columns , and then I created a new report that is linked to this datatable using the report wizard. In my form there is a button when clicked should fill the datatable mentioned above ( I checked if it is being filled by displaying its content in a dataGridView and by firing a messagebox that is triggered when 'datatable.rows.count > 0' ).
The reason that the datatable is initially empty is that it depends on some conditions that may alter the query used to fill it.
But finally when I load the form that has the report viewer it only has the names of the columns of the datatable and no contents. What's wrong ?
View 5 Replies
View Related
Apr 17, 2015
Here's my code so far:
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int dayNumber = 1;
[Code] ....
The code, when run, prompts the user to input an integer like this:
Code:
Day 1
Andy :>12
Bill :>7
Charlie :>15
Day 2
Andy :>5
Bill :>25
Charlie :>14
.
.
.
etc.
Ok, so the code prompts the user to enter an integer for each of the 3 persons and then increments the "Day" and so on... When the user enters a negative value (-1, -2, etc.), the loop is broken and the program ends. Alright, everything is hunky-dory so far. 2 things which I can't figure out.
1. when the user doesn't enter anything and just hits return, the cursor drops a line and is still awaiting an input but doesn't show the prompt "Andy :>", for example. How can I get it to repeat the last prompt when the user doesn't enter anything? Like:
Code:
Day 1
Andy :>
Andy :>
Andy :>12
Bill :>25
Charlie :>15
.
.
etc.
2. When the user enters a letter or a special character, the program blows up. How can I correct this?
I've tried changing the data type for the variable used for the input, tried using getline, get, etc. With my current beginner knowledge, I'm missing something. So how can I get this to work?
The program should allow only integers to be entered, while allowing a negative number to trigger the loop to break or the program to end, and while re-prompting the last person if the user entered an invalid input.
View 13 Replies
View Related
Aug 26, 2014
I am wondering what the best way would be for me to pass a piece of data between all of my different windows and user controls in my program.
Would i have to pass it separately between them e.g. add a piece of code into the button click event that will open the new window.
Or is there a way i can make it so that it is declared in the first window and then is accessible by all other windows and user controls.
Note: this is using WPF.
View 14 Replies
View Related
Jan 31, 2013
I am trying to populate a list control with the filename and maybe some other thing when i push the OK button....
Code:
void CThisDlg::OnOK() {
int iItem = 0, iActualItem = 0;
HANDLE hFind;
WIN32_FIND_DATA data2;
int iNum = 0;
hFind = FindFirstFile("*.*", &data2);
[Code] ....
When i push ok, no files get loaded. I also attached a image
View 13 Replies
View Related
Jul 23, 2014
I wrote a code to read a specific amount of data from file until terminating set is reached. however the code does what its supposed to correctly until it reaches the 5th loop it justs stops responding. I've checked the reading file and all elements are correct in the file.
Code:
int main(void){
FILE *file1;
FILE *file2;
FILE *file3;
struct t test1;
struct t test2;
[Code] ....
Screenshot of program crashing:
Screenshot of reading file:
View 11 Replies
View Related
Mar 5, 2013
How do I make a specific character show up a specific amount of times?
Like I am generating a random number then I need to make "|" show up that many times on the screen.
View 1 Replies
View Related
Nov 7, 2013
X and Y are numbers
For example: how many 2 or/and 5 are inside range of 0 to 30.
for or: there are 8 (2,5,12,15,22,25)
for and: there is only one (25).
View 1 Replies
View Related
Feb 16, 2014
In my C++ program, lets call it menu.exe, I want the user to be able to run a specific program when selecting a specific menu, let's call this program cios.exe.
As the users of my program can have the cios.exe installed in any folder location, I need a way to first locate where the cios.exe is located and then start it with ShellExecute. My problem is : How do I find the path to where cios.exe is located in anyones PC as it can be installed it any folder location.
View 3 Replies
View Related
May 6, 2014
is there any way to have the program control go some two paths at once? For example: if my program has two functions, one that does some simple calculation that requires nothing from outside it to set the variables and another that displays text for the user to read then enter something. Is there any way to have both run at the same time?
simpleFnc()
{int a = 1;
int b = 2 ;
int c = a+b ;
[code]....
There is no connection of simplefnc to anywhere else in the program so is there any way to get it to run at the same time the other function is running?
View 4 Replies
View Related
Jul 18, 2014
I am having trouble understanding what I need to do to halt the flow of a program until a video file finishes playing. So far I have accomplished getting the video to play, but the program continues while the video is playing rendering the content of the program on top of the video making it not seen.
My goal is to make the video play, then once it has finished the rest of the program should run.
So far I have this in the start up area of my code:
//Initialize components for DirectShow to stream a video at start-up
CoInitialize(NULL);
//creates filter graph manager
[Code].....
After this code runs once, the program proceeds immediately into the loop where my update and render functions for the program runs. Preferably, I want to stop just the render function while allowing the update to continue to check if the user presses a key to skip the video. What do I need to add to the code to do this?
View 1 Replies
View Related