I have created this code; it is a taxi management system. I've made a class 'List' which handle a linked list structure of the waiting taxis and waiting passengers. The class has a public int variable: waiting, which keeps track of the number of waiting taxis/passengers.
#include<iostream>
using namespace std;
class Queue{ //Class for indivdual taxis and passengers, which will be members of linked list.
public:
string id;
Queue *next;
Queue (){
[Code] .....
But when I run the code and type in a new taxi number, the code does not increment the number of taxis by one the linked list by one. I can't seem to find the problem.
BTW, in the 'int main', I've added "<< taxi_list.waiting" at the end of the line after the user inputs the new taxi registration number, so that I can see how many taxis are now on the list. This is what is being shown as zero, no matter what.
I've read up on .bmp files on wikipedia and am currently attempting to make a function that can export a .bmp file of the screen of my programs. I've already begun work on it but it isn't working. The code I have so far is:
typedef char Byte; typedef int Byte4; typedef short Byte2; struct BMP_Header {
[Code] ....
My problems are that when less then the required amount of bytes is needed to store a value in the file, the 00 bytes are skipped (Ex. The file will contain 42 instead of 42 00 00 00), and the Pixels are stored as nothing but 0D ( every value intended for storing pixel data is 0D ).
I decided to code my own GUI menu. getting to another page from a button click. I have added the event handler I think (click="Button_click") then in the event handler I have added this:
After researching it says either to use Response.Redirect("Login.xaml"); OR Server.Transfer("Login.xaml"); Neither of these work, underlining "Response" and "Server" as an error saying "A namespace cannot directly contain members such as fields or methods."
NOTE: MY MAIN GUI PAGE IS CALLED "mainpage.xaml" THE CODE ABOVE IS STORED IN THE "mainpage.xaml.cs" THIS MIGHT BE RIGHT OR WRONG BUT I'M NOT SURE SO I AM LEAVING SOME EXTRA INFO!
I am trying to work on a C++ program to calculate the quadratic formula using input files and classes. I have written my class, but I am trying to find a way to take an input file with unknown number of lines of coefficients. How do I take each integer from each line and set that value as "a" and "b" and so forth, then start over on the next line?
This is what i have so far.
fstream inputfile;//users input quadratic coefficients file ofstream outputfile;// outputs a file with solutions int main(int argc, char *argv[])// argc is argument count, char *argv[] is array of array of characters for arguments { string dataline; getline(inputfile, dataline);
Ok so I have a class that takes integer fractions and I want it to be able to take doubles also depending on what the user inputs. How would I go about this? I was thinking templates ...
I am again a bit confused with bool since we have not used them much. I understand it is suppose to return a true or false value that is represented by 0 and 1. so I have these two bool's
cout << "Is this a right triangle: " << t2.isRight() << endl; cout << "is this a Triangle: " << t2.isTriangle() << endl;
and i get this "Is this a right triangle: " 0 "Is this a triangle: " 1
Which i know is correct but I want to replace the 1 and 0 with my own string but the things iv tried tweaking with has not worked.
Also in the file attached has some requirements from my teacher but i was confused at the second last one, --- bool isEqual(Triangle &other) and it says return true if triangles are equal and false if triangles are not.
I dont know if this is just simply if one triangle equals another (however you determine that) or if its for the two bool's, isTriangle() and isRight() or what.
How can I take in a path name like "C:myfolderfile.txt" where the user enters exactly that? I've tried putting the arg into a string, then looping through the string to find the '\', but by that time it is too late as c++ considers the '' as a escape character.
Is this even possible? I've googled it and everyone just says to make the user input the path with double \ or with a /.
Parts of this program are missing. The last few lines are confusing, since the variable 'a' gets incremented then decremented. But there are no loops. I understand that the value of 'a' is passed to 'c' before 'a' is changed in both cases.
But where, and when, do the changes take place? Is the decrement ever processed? Is there a better way to write these lines?
Code: main(){ int a = 21;int b = 10;int c ; c = a++; cout << "Line 6 - Value of c is :" << c << endl ; c = a--; cout << "Line 7 - Value of c is :" << c << endl ; return 0;}
I was browsing the web looking for simple yet fun programming challenges and crossed this one. I figured out how to reverse the string in place but I want it to read "blue is house the". I approached it in two ways for the heck of it. My idea was the second one, the first one I googled. I didn't know a simple rbegin() could do that, pretty neat.
I found the question here.[URL] ....
Code: #include <iostream> #include <string> int main(int argc, const char * argv[]) { std::string phrase = "The house is blue.";
I am trying to call Display menu. If up key is pressed Displayed has to be incremented and stay in particular window if Decremented, go to previous Display function and show previous Display function. LCD & Keypad Shield Quickstart Guide | Freetronics
I need function to determine where to place new element in sorted array. I want to use binary search to find index where element should be placed, when push all others.
Prototype should be something like
int WhereToPlaceElement(ElementType hash); // uses private atribute ElType** elements
I have tried my best to write, but all tries ended in inf loops and reading invalid locations of array.
void main() { int a=1; cout<<a++<<" "<<++a<<" "<<a++<<endl; }
If I execute the above program i should get 1 3 3. But I'm getting different values when I executed this program. The values that I get after execution are 3 3 1.
I have an issue with my codes as according to what I created the fitness level have to appear right after I enter the time take to 3 miles. However it only appears once after repeating five times.
When I drag a control onto the Xamarin studio layout the control just slides back into the toolbox again. The only way to add controls is to edit the .axml file which is not at all ideal.
I have tried re-installing all the components again multiple times and even tried out using a different computer, still no luck. How to use the mono framework on the Visual studio IDE and build the apk using Xamarin studios?
I'm currently working on a program to take the user's input as DDDD.CC and then converting it to the least amount of coins using quarters, dimes, nickels, and pennies. I was told to not use any doubles or floats as they would produce errors. And supposed to the use the library function atoi() after I take the input user's amount as a string to convert it into an integer.
So far the string input has worked and it produced the right number of quarters but it leaves off the cents. For example, I put in 352.23 and it gives the right amount of quarters but leaves off the 23 cents.here's my code:
#include <iostream> // Allows the program to perform input and output #include <stdlib.h> // Atoi #include <string> using namespace std ; // Enables a program to use all the names in any Standard C++ header int main() // Start of program execution { string line ;
cheapest item = Oranges most expensive item = Raspberries total cost = 55.44 shopper = Winnie B. The Pooh
When I run my code however, it doesn't get past shampoo and will continue to add shampoo to the total cost infinitely. How can I change the code to produce the proper information?
I have a text file that ifstream opens and fills some fields with the data. I've been able to get at the file, by using the precise path, but that path would be incorrect on other computers I'll be working on the project at. So, is there default location I should drop the folder in, and route to with the path? If not which Directory listing in Visual Studio 2013 should I use so the project can find the folder?
This is how I've formatted the string for ifstream.