C++ :: Program To Model Operation Of Incoming Flights Computer Screen
Apr 14, 2013
The project is "Design and write a program to model the operation of incoming flights computer screen that is normally found at a typical small airport like Moshoeshoe I airport (if they do have one). The following provides the information that needs to be displayed about each flight:
• Airline - [string of maximum length 15] Name of the airline, eg. FlySAA
• Flight Number - [string of maximum length 5] eg. 04120
• Origin - [string of maximum length 25] Place where the flight originated from eg. Johannesburg
• Date/Time - [integers: Hour, Minute, Day, Month, Year] Arrival time of the flight
• Status - [string of maximum length 15] Whether the flight is "OnTime" or "Delayed"
View 4 Replies
ADVERTISEMENT
Nov 20, 2014
I have a problem with a program..I wanna make a program for scan the computer screen.I mean for example there is a video which shows just 5 pictures(apple,pear,banana,strawberry,cherry pictures) but this pictures are turning nonstop in one second. and this case is continuous progress.There are 5 pictures and are chancing. Lets get my problem, I wanna make a program and when apple on the screen my keyboard will push 1,when pear on the screen my keyboard will push 2,banana is 3,strawberry is 4,cherry is 5. I have this 5 pictures which are in the video and I will introduce tham to program and I wanna compare my lib. and screen and get output.
View 3 Replies
View Related
Mar 2, 2013
In 83rd line message says: "Illegal Structure operation". But I didn't use any structures! How to correct it?
#include<iostream.h>
#include<conio.h>
#include<math.h>
int prime(int);
int reverse(int) ;
int power(int,int);
int rectangle(int,int);
int square(int);
int circle(int);
void tables(int);
[Code] ....
View 6 Replies
View Related
Jan 1, 2014
I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.
One two three four five
(newline) Six seven eight
The computer will stop reading after 'five'. I assume that is because I use fgets.
View 4 Replies
View Related
Feb 26, 2013
I have a weird problem, my computer restarts imidiately after program writen in dev-cpp is compiled AND run. When I run any program, it lasts about 1 second, then program closes, and computer reboots. It doesn't matter whether program is writen now or earlier, my dev-cpp version is 4.9.9.2. Source code can be as simple as this:
#include <iostream>
#include <conio.h>
using namespace std;
int main() {
getch();
return 0;
}
and it restarts anyway...
View 2 Replies
View Related
Sep 21, 2014
I have several machines (could be 1, 2, or 30) sending/receiving data to/from a computer via Wi-Fi. At the moment I am in the process of trying to store that data into txt files, but that is another issue. Say that I managed to have different txt files to pick up the information received, one per machine, now what I need is to process that information in the following way (will show with an example):
String data ("W" followed by the value that I need to process) is sent to the computer by every single machine, every 100 milliseconds, like:
W0.000
W0.000
W1.000
W25.000
W56.000
W70.000
W100.000
W100.000
W100.000
W123.000
W98.000
W30.000
W10.000
W0.000
W0.000
For the example above I need to store the value "100" (in a .csv file, one per machine) as it is the last "stable" value before the reading drops quickly to zero. Afterwards, I would use the stored data to create graphs and summaries, in a "live" mode, so the graphs are refreshed with the new data as they come in from the machines. I am using C++ with Visual C++ Express.
View 2 Replies
View Related
Feb 19, 2013
I am making a program where a computer and player take turns rolling dice.
There seems to be an issue somewhere in my loop where when the player selects from the possible dice choices, it rolls for the computer and does not select the choice and it immediately becomes the player's turn again.
I am trying to get it to where when the computer rolls the dice, it should display the list of possible values, and ask the user to hit the enter key in order for the computer to choose which value to select using the following command:
Code:
while ( getchar() != '
' ) ; I've tried it a hundred times and no matter where I put the command it still skips the computer's turn.
Below is my code:
Code:
while (compscore < 99 && playerscore < 99){
printf("You have rolled the following pair of dice:
");
a =("%i ", rand() % (MAX_VAL - MIN_VAL + 1) + MIN_VAL);
b =("%i ", rand() % (MAX_VAL - MIN_VAL + 1) + MIN_VAL);
multiply = a * b;
[Code] ....
View 11 Replies
View Related
Jun 19, 2014
How you can make a c++ program that checks to see if the user presses the power button on their computer? And if so, how?
View 1 Replies
View Related
Feb 11, 2013
I'm currently creating a guessing game program where the user will be asked to guess the computer generated number. Once the program is finished, at the end the user will be asked if they want to play again. If the user types "Y or Y" the program will loop and when the user types "n or N" it will not loop. Check out my code below.
#include<iostream.h>
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<conio.h>
#define g gotoxy
void main(){
int a,l,b,guess,row,col,answer,num,clue=5;
[Code] ....
I can't loop this program.
View 3 Replies
View Related
Mar 22, 2014
How to capture incoming serial data and store it into an array for controlling functions. But I am now working with a radio module that receives incoming data and stores it into a uint_8t.
From there in the basic sketch that the radio library came with it is printed in the serial terminal like this:
uint8_t buf[RF22_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf22.waitAvailableTimeout(500)) {
// Should be a message for us now
if (rf22.recv(buf, &len)) {
Serial.print("got reply: ");
Serial.println((char*)buf);
I have read a lot of tutorials on pointers, and I am just having a very hard time grasping how to extract data out of one. I realize this is char and not integers. The goal is to transmit five integers in a digital state of either 1 or 0, and then store them in the receiving side and control 5 outputs based on the status of those 5 bits. This is proving to be quite confusing for me though as I cannot seem to grasp how to control the pointer logic.
View 1 Replies
View Related
Dec 27, 2013
Write a class called MyTriangle, which models a triangle with 3 vertices, is designed as follows. It contains:
1. The MyTriangle class uses three MyPoint instances as the three vertices.
2. Three private instance variables v1, v2, v3 (instances of MyPoint), for the three vertices.
3. A constructor that constructs a MyTriangle with three points v1=(x1, y1), v2=(x2, y2), v3=(x3, y3).
4. An overloaded constructor that constructs MyTriangle given three instances of MyPoint.
5. A toString() function that returns a string description of the instance in the format "Triangle @ (x1, y1), (x2, y2), (x3, y3)".
6. A getPerimeter() function that returns the length of the perimeter in double. You should use the distance() method of MyPoint to compute the perimeter.
7. Also write a test program (called main.cpp) to test all the functions defined in the class (example of a triangle: (-2, 1), (1, 3) and (3, -3)).
class MyTriangle {
MyPoint v1;
MyPoint v2;
MyPoint v3;
public:
MyTriangle(int x1,int y1,int x2,int y2,int x3,int y3) {
[Code] .....
View 3 Replies
View Related
Dec 9, 2014
how to put together a basic ray tracer which can model spheres and planes. I have an example ray tracer which I am currently pulling apart and sifting through line by line to try and understand exactly how it works. I have come to a point in the code which I am having trouble explaining adequately. It's a method of the Plane class, which is a class defining the planes in the scene. The method is called findIntersection and I believe its purpose is to return the distance between the origin of the ray and the point of intersection, it looks like this
double findIntersection(Ray ray){
Vector ray_direction=ray.getDirection();
double a = ray_direction.DotProduct(normal);
if(a==0){
return -1;
}
else{
double b=normal.DotProduct(ray.getStart()+((normal*distance).Inverse()));
return -1*b/a;
}
}
The method accepts arguments of type Ray which is a class defining rays, rays are constructed from this class by supplying two vectors, a starting vector and a direction vector, the Ray class has a method function getDirection which is used in the first line of the findIntersection function which clearly just returns the direction vector. The DotProduct method being accessed belongs to the Vector class and is a standard method for finding the dot product of two vectors. "normal" is a variable of type Vector and is used in the construction of an instance of the Plane class, along with a distance from the centre of the scene and a colour. Also, in the line double b=normal.DotProduct(ray.getStart()+((normal*distance).Inverse())); the plus sign between the two vectors is an overloaded operator which adds the two vectors in the usual mathematical way, I overloaded it for neatness.
The trouble I'm having is working out what the variables a and b are doing, what they mean geometrically and how they correspond to getting the distance between ray origin and point of intersection. Clearly if the dot product of the normal with the ray equals zero then the ray is parallel to the plane and so there is no intersection but what is a's role in the return statement.
View 3 Replies
View Related
May 2, 2013
I need to create a if else statement to check multiple model numbers (200+)... How can i build this? I basically want the user to enter their model number and if its on the list they get a approved or denied message.
So far I have this, the "if(model == 9002||1002)" doesnt seem right, it needs to basically check 200+ model numbers... am I even on the right track?
Code:
#include <iostream>
using namespace std;
int main(){
int model;
cout << "Enter model" << endl;
[Code] .....
View 3 Replies
View Related
Feb 2, 2013
I have done a test, I have edited with the WordPad in Windows on my Local Webserver a file banana.h which contains a list of float arrays in order to extract one array and create a text file named ObjVerts.txt I have done a lot of search in the Web in order to find a small piece of code that can read the text file and convert it to a float array GLfloat, but I did not find any. I have found a lot of piece of code that read the file and make a NSData but many of the code seem to not work. It seem that the last statement return nothing!
NSURL *myurl = [NSURL URLWithString:@"http://localhost/ObjVerts.txt"];
//NSString *mystring = [NSString stringWithContentsOfURL:myurl];
NSData *mydata = [NSData dataWithContentsOfURL:myurl];
View 1 Replies
View Related
May 15, 2014
I'm trying to analyze Population Dynamics. I found some articles and read them but what kind of model i need to use. I tried Forest Fire model but i failed in modificating.
#include <stdio.h>
#include <stdlib.h>
#define MaxPopulation 10000
#define MaxChildren 10
#define maxAge 70
#define ranf() ((double) random()/(double)RAND_MAX)
View 7 Replies
View Related
Oct 8, 2014
For my class we have to take a screenshot of the program and put it in a word document. How can I accomplish this?
View 2 Replies
View Related
May 29, 2013
I'm trying to write a program that prints all of the prime numbers to the screen. I'm getting angry because it only prints EVERY number. I think it has something to do with the bool change not being able to leave the for-loop but how to fix it.
Code:
#import <stdio.h>
#include <stdbool.h>
int main(void){
printf("
The Primes Are: 1");
[Code] ....
View 3 Replies
View Related
Dec 5, 2013
So, I'm making a program in C++ that emulates a full screen console... I used SetCurrentConsoleFontEx to set the font to 12x16 but it sucks...
Anyway, I read here: [URL] .... that also the console font can be changed, but I can't make it work! How can i set the font to Lucida Console? This is the function I use to change font size:
void setFontSize(int x, int y) {
PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx = new CONSOLE_FONT_INFOEX();
lpConsoleCurrentFontEx->cbSize = sizeof(CONSOLE_FONT_INFOEX);
GetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), NULL, lpConsoleCurrentFontEx);
lpConsoleCurrentFontEx->dwFontSize.X = x;
lpConsoleCurrentFontEx->dwFontSize.Y = y;
SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), NULL, lpConsoleCurrentFontEx);
}
View 2 Replies
View Related
Oct 10, 2014
Why this program won't correctly print the proper totals on screen? See my code and the included screenshot.
Code:
#include <stdio.h>
int main(void) {
int total, first, second;
printf("Enter 2 numbers:
[Code] .....
View 4 Replies
View Related
Jun 29, 2013
I wanted to make the terminal screen bigger in my NCurses program. Let's say if the defaults are 25 LINES and 80 COLS, I want to set them to 40 LINES and 120 COLS.
I've tried resizing all windows, but that did not work, because the actual terminal (console) was not resized. Then I found functions resizeterm and newterm, but they did not work. As far as my understanding goes resizeterm only updates NCurses information with the current configuration, while the window itself is not actually modified.
NCurses man page wrote:The function resizeterm resizes the standard and current windows to the specified dimensions
If I haven't made myself clear ( I sometimes make a mess of things... ), another example would be that I want my program to be fullscreen when I start it. Is this possible? It should be, I found a fullscreen NCurses program once, but the code was too confusing for me to understand.
Having read about things like SIGWINCH, I assume you must define a method for resizing the terminal screen yourself, I don't know where to start?
View 11 Replies
View Related
Oct 7, 2014
NOTES AT BOTTOM---EXPLANTION, PROBLEMS ETC. SCROLL DOWN
#include <iostream>
#include <iomanip>
#include <string>
[Code]....
I have to write a program that stores information about students and displays results (Formated). Example-
Inputs ( # of students, First and Last name of student, the gender, age, and hieght. (height inputed as inches and outputed as feet and inches))
Student 2
---------
Jett, Joan Female
100 years old 5' 7"
Ive been falling behind a little due to working late and barely having time for my school work. Coming across several issues, one being an error with GENDER (Error C4700: uninitialized local variable 'gender' used:). As well as how to format the end result, i understand that u have to use #include <iomanip>, but am confused on how to format correctly.
View 2 Replies
View Related
Nov 11, 2013
For my C programming module, I've been asked to create a program which is basically a ten question mathematics quiz or test if you like. Below is a copy and paste of my current, working program.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main () {
[Code]....
I am also trying to include into my program; If the user achieves 4 or less marks in the test, they are asked if they would like to repeat the test (have a second chance).
I have been asked by my Lecturer to ask the Question; "Would you like to try again" and the response is 'Y' for yes, 'N' for no. Would this be shown by:
char Y = Y;
char N = N;
printf("Would you like another go?");
scanf(%d%, &Y, &N);
And finally; If the user would like another go, then I am trying to include the code that clears the screen and then reloads the program?
What code is used to clear the screen and no clue what code is written to refresh or reload the program. I assume it's a loop statement or some sort.
View 1 Replies
View Related
Jun 15, 2013
I seem to be missing a concept or 2 here ... I am tasked with writing a program that reads text from a file and outputs each line to the screen as well as to another file PRECEDED by a line number ...
In addition, I have to Print the line number at the start of the line and right-adjusted in a field of 3 spaces ...
Follow the line number with a colon then 1 space, then the text of the line.
Another kicker, is I have to grab the data 1 character at a time and write code to ignore leading blanks on each line.
Here is what I have so far:
#include <iostream>
#include <conio.h>
#include <fstream>
#include <string>
#include <cstdlib>
#include <cctype>
using namespace std;
int main() {
char next;
int count = 0;
[Code] ....
View 7 Replies
View Related
Feb 18, 2015
Basically this is what i need to do. Write a program that reads a number from the keyboard, separates it into its individual digits and prints the digits to screen, each on its own line followed by the same number of stars as itself.
For example, if the number is 2339 the program should print
9 *********
3 ***
3 ***
2 **
So far i have managed to separate the number and have them on different lines, but how to implement the stars onto each line with the number!
My code so far:
int main() {
int n;
printf("number? ");
scanf("%d", &n);
while (n > 0) {
printf("
%d
[Code]...
View 4 Replies
View Related
Mar 13, 2015
I am just trying to get a code going for a mock test and to get use to the getline and IF operations, but it seems I have ran into an issue[URL] is a link to the code I have written, and I can use getline to give a value to my variable, but it seems like it gets lost once I try to use the IF function. Am I not using the right variable type?
View 14 Replies
View Related
Jan 27, 2013
Code:
int i=5,j;
j=++i + ++i + ++i;
printf("%d",j); //22
i=5;
j=i++ + i++ + i++;
printf("%d",j); //19 Shall not it give 21 and 18 respectively?????
View 4 Replies
View Related