I am trying to add matrices a and b. I am getting an error in the "add" function, probably because I have m[i] in it, and m is not an array. What is the correct way of writing the "add" member function here?
Also, although the "read" and "write" member functions of the class are working just fine, do you think there is a better way of writing them?
Code: #include <iostream> #include <cmath> #include <iomanip> using namespace std; const int rows=3; const int columns=3;
I am trying to solve some random puzzles so I do not lose/forget c++. I never used hashtables in C++ and decided I needed to brush up. I am having in creating a hashmap that holds objects with a string as a key:
Code: #pragma once #include <iostream> #include <unordered_map> class WordCount
I am doing a remake of the classic game: Frogger. Currently, I have the world set up, the frog moves about in the world how I want it to, but I cannot get the cars or the logs to move simultaneously with the frog. I have posted my source code on GitHub.
Is it possible to check for chronological arrangement of two time objects most possibly without using an if statement ? Well this is off topic but there may be a python guru around,..is it possible to do similar thing in python?
I am trying to add some data to my SQL database using EntityFramework as so:
[HttpPost] public ActionResult Add(string moduleCode) { HttpCookie cookie = Request.Cookies["UserLogin"];
[Code]....
When ever it gets to the stage of db.SaveChanges() I get this error, but using intellisense I have checked the values in the object and there are no Null fields.
Do you think It might be better to use SQLConnection instead? Also I beleive EntityFramework is more secure becuase there is no SQL Injection, is this correct? So If I do go down the SQLConnection route could this SQL Injection pose a threat?
I am creating code for a group project in my class. All my group members made a header file with an object in it with their functions. One of the functions in my partner's code uses a data member of mine in the function, so she has the function parameter a object of my object. (This isn't the code but for example)
class B { friend class A; void displayAthing(A object) { cout<<object.thing<<endl; }
I have this when I call the function in the cpp file
int main() { A object; B b; b.displayAthing(object); return 0; }
However, when I compile, it gives me an error that the function does not take 1 arguments.
I was trying to write a character controller but when I went to add my pointer to my character I get error
C2143: syntax error : missing ';' before '*'
I've looked at all my classes involved but I don't see any errors and Visual Studio doesn't report any other specific errors. Is there any way of finding the source of this type of error?
I once again have a logic error. This time I am positively baffled: I am making a function that messes with three vectors it receives as parameters. The function adds new items to those vectors, but the funny thing is, while it completely normally adds items to two of the three, it fails to do so for the first, despite the fact that I use the same template! Here the function is:
So I made a library for a whole bunch of functions and when i compile it, it says"Unresolved external symbol_(Name of function here) referenced in function main.
I wrote program for Sequential matrix multiplication .But after execution for any input value( ex. 100,150,400) it shows the execution time is 0.000 msec.
#include <stdio.h> #include <math.h> #include <sys/time.h> void print_results(char *prompt, int N, float *a); int main(int argc, char *argv[])
I am currently working on a lab for my intro to programming class and the lab is asking for a long distance call calculator. Based on the times that you start your rate will change. If the call starts from 00:00 to 07:59, Rate = $0.07. If the call starts from 08:00 to 18.59, Rate = $0.12. Lastly if the call starts from 19:00 to 23:59, your rate is $0.28.
Then on the output you must show the start time, end time, rate, and total cost of the call.
My confusion is on the end part of the code (the output).
I know you have to use the % operator to convert minutes to hours, but I don't completely understand it which is why I am here. How does the modulus do that? And how will it go over to the next hour if the call starts at 1:35 and ends after 30 minutes (2:05)?
Here is what I have so far.
#include <iostream> #include <string> using namespace std; int main() { float callStart, minutes; double cost; char choice('Y'); string rate;
In an assignment where they were asked to write a simple alarm that went off every 12 hours. This seemed mildly interesting so I gave it a go. The alarm actually goes off every minute (to have it go off every hour, or every 12, or some other interval more cogs, shafts and pinions would need to be added to the mechanism).
Code: /* A simple "stopwatch" that prints an alarm message every minute. * * 2-Nov-2013 * */ #include <stdio.h> #include <stdbool.h> #include <time.h>
I'm writing a program that converts seconds to hours and minutes - That works fine! But if I write: 3700 seconds It answers That equals to: 1 hours, 1 minutes and 40 seconds.
I now want my program to write 1 hour, 1 minute and 40 seconds.
And if there is no hours at all it should only write 400 seconds equals 6 minutes and 40 seconds.
To sum up: The program shall write hour/hours minute/minutes second/seconds correct.
I've made one succesfull program, but it was written with 27 "if-statements" and I know there is a better way.
Code:
#include <stdio.h> int main(void) {
[Code]...
how to make the program know when to write hour or hours?
Write a payroll program that prompts for the number of hours an employee worked, as well as the employee’s pay rate. If the employee worked for 40 hours or less, the gross pay is calculated by multiplying the number of hours worked by the pay rate. If the number of hours worked by the employee exceeds 40 hours, the employee should receive regular pay for the first 40 hours, and receive time-and-a-half pay for the hours in excess of 40. Display the calculated gross pay on the screen.
Continue to prompt for similar data for more employees and have the gross pay of each employee displayed, until there is no more employee data to process. Then display “Good Bye”.
Your solution must be separated into three source files (Interface, Implementation, and Test)
ok so i did a program that will take the number of hours worked in a week annd the number of dependents ans inputs and then outputs the workers gross pay, each withholding amount, and the net take home pay per week.
The Program should come out as this:
Regular Hours :34 Overtime hours: 0 gross pay : $323.00 social tax: 19.38 federal tax: $45.22 Statte tax: $16.15 Number of dependents covered: 2 additional health insurance expence: $0
Net take home pay: $236.25
The employer pay rate is 9.50 the employer worked 34 hours "regular hours 40 or less" if any hours are paid at over time rate of one and one half time that from the gross pay, 6% of social is with held, 14% form federal income, 5% from state income, 6$ per week from union dues, and if worker has 3 or more covered dependent, then an additional 10$ is wothheld to cover the extra cost of health insurance
heres my program:
#include <iostream> using namespace std; int main () { int regHours; // Regular Hours float hourlyPay, gross, otime, socialtax, federaltax, statetax, uniondues, dep, health; // gross income, overtime, social tax, federal tax, state tax, union dues, depen covered, health insurance
[Code] .....
the program runs but theres still errors in it, it did not make some of the calculations right.
What formula do I use to calculate overtime hours if there was over time? What formula do I use to take out union dues from total income? How to I set the number of independents covered to match the health cost if it was 3 or more?
Create a class to store a value that represents number of hours worked and number of days worked. Must ensure that the two representations are always consistent. I have to create 2 files, I'm pretty sure: a .cpp and a .h
This is what I have so far for my .h file (I know it's NOT functional...yet):
#include <iostream> using namespace std; class NumDays { private: double hours; double days;
[Code] ...
I don't know how to start / create this .cpp file to define the variables.
The problem is that I need to figure out the user's birthday in months, days, hours, and minutes from today's date.
Here's what I have so far.
#include<iostream> #include<cmath> #include<ctime> using namespace std; int main() { int todayDay, todayMonth, todayYear; int birthDay, birthMonth, birthYear;
[Code] ....
I haven't initialized all the variables, yet. And it's very unfinished. I need to figure out how to convert years from the age into months only. And I need to figure out how to calculate the hours, seconds, and minutes.
Write a program in C++ that calculates the amount to be paid to an employee based on the hours worked and rate per hour. A user will enter hours worked and rate per hour for an employee. Your program should have a function payCheck that calculates and returns the amount to be paid. The formula for calculating the salary amount is as follows: for the first 40 hours, the rate is the given rate (the rate that a user has entered); for hours over 40, the rate is 1.5 times the given rate.
I had write my own coding, but it keeps error. it is okay. But i still don't think i could share here? Still running... I will update my coding for you alls to check for any syntax or logic error. The problem is i need to calculate if the employee work for more than 40 hours which 1.5 times.
This is a round robin execution. with gantt chart. arrival time and burst time. I think there is an error in my formula to get the right answer,i cant resolve it but my program is running. What is the code or the right formula??
#include<stdio.h> int main(){ int i,j=0,n,time,remain,flag=0,ts; int sum_wait=0,sum_turnaround=0,at[10],bt[10],rt[10]; int ganttP[50],ganttStartTime[50]; printf("Enter no of Processes : "); scanf("%d",&n); remain=n;
This has been bothering me for a while now, and I finally put together an example:
#include <iostream> #include <string> using namespace::std;
[Code]....
In the code above, the two classes hold pointers to each other, and that's fine but it doesn't seem right since C++ prefers to pass by reference. Yes, it can still do that (see testbox and testball) but even that seems odd to me because still you need to use pointer notation for the enclosed object. Am I the only one who feels this way, and should I just get over it? Or am I missing something that would allow an object to hold a reference?