We have been assigned to create a program that uses multiple functions. The professor has given us code for two of the functions, one to open a file and then another one to read the files contents and output them. I have put these into my program but they will not execute. The program does run, but the functions themselves are not executing. I have practiced with other functions that contain no parameters and those run fine, but the functions she gave us have multiple parameters.
I am getting an error on lines 31 and 36 about an expected identifier on my program that computes area and circumference. Is something wrong with my external functions outside of main?
I already wrote a program that will calculate the gross pay for a set of employees.
I want modify the code by adding multiple functions.
I want to create a separate function whenever possible to break up the program.
For example, I would like have a function for obtaining the hours from the user, another function for calculating overtime hours, another for calculating gross pay and another function for producing the output.
#include <stdio.h> #include <stdlib.h> #define STD_HOURS 40.0 #define OT hour>STD_HOURS #define SIZE 5 int main() { int clockNumber[SIZE] = {98401, 526488, 765349, 34645, 127615}; /* employee ID */
I am returning area from areaCircle(), but do not know how to print it in main. I know this program has lots of errors, two cases that I have listed.
Not sure how to properly list multiple function calls in a switch statement, and how to print one's return from main.
int main() { char choice; double area; showMenu(choice); switch (choice) // If input is C, use getRadius, areaCircle and count, then print the are { case 'C': void getRadius(),double areaCircle(), void count(bool display = false);
Is there a way to tell the program to continue reading the next line of code within a nested IF statement?
The reason I want to do this is because the two "else" statements in the following sample (the main and the nested else) will contain the same exact code and I don't want to repeat it twice. I know I can do this by creating a function and calling it from each else statement but I was just wondering if what I'm asking is even possible without using a function.
if(1 < 2) { // yes 1 is less than 2 if(5 > 10) { // do something } else { // no, 5 in not greater than 10 // here is where I want to tell the program to continue reading the next else statement
This code i made is a cent converter from 5 to 95 cents. The problem i'm receiving is when the 'cents' function is sent back to the 'main' function it only prints one line. It seems to just print the first if construct that complies with the statement. Is there anyway i can have this function print multiple cent values? For example if 60 cents was entered it would only print '50c', and i want it to print '50c' and '10c' instead.
Code:
#include <stdio.h> int x; void check(int x) { if( x < 5) printf("Less then 5 cannot be calculated "); else if(x > 95)
I currently have globally declared arrays, which are accessed by multiple functions. I want to turn the program so that the arrays are no longer globally declared, but are passed to functions by reference.
I have one problem with passing the arrays: I found that, through debugging, I HAVE TO resize the array when I pass it by reference. For instance, I was using int a[10] when it was globally declared, when it is passed by reference with size 10, it does not work, instead it should be higher than 10 (certain number). Why is this happening? I do not get it...
how I can run this as a separate process from the parent program, like a child process,
and return the result back to the parent program.
this script is as follows.
if file "/Stuff/s" exists then continue to run, if file "/Stuff/t" exists, then print "started" if file "/Stuff/t" does not exists, then print "stopped"
if file "/Stuff/s" does not exist then print "quit" and then quit.
I have this problem for an assignment, and one of the functions that I created for it is nothing fancy; just a function that'll take in a number and error-check to make sure the input is valid. However, after doing it, when the program calls that function, it skips the cin statement and ends the program, without letting the user input his number. The function in question is called getSubLength.
Code: #include <iostream> #include <string> #include <iomanip> #include <cstdlib> using namespace std; const string JANUARY = "January";
in the below program for both class pointers pointing to null. Class contains normal function executing but class contains virtual function getting segmentation fault.
using namespace System; ref class A { public: A(){Console::WriteLine(L"A constructor");} virtual void func(){foo();} void foo()
[Code] .....
Supposing that class A is the development code; and so for unit-testing purpose I create a mock for it. But I don't know how to override A's constructor such that it will not get executed in my unit-test code.
I am currently working on a c++ project that will input students and process their grades. I encountered a problem and my code stops executing after the getScores function. Im not sure what the problem is, but im guessing its something within the function and the loops.
//Name: getScores //Description: Will get scores for student //Parameters: None //Return: testScore double getScores()
i am trying to create a program for multiple windows. Here is my code
#include<Windows.h> // Store handles to the main window and application instance globally. HWND ghFirstWnd =0; HWND ghSecondWnd=0; HWND ghThirdWnd=0; HINSTANCE ghAppInst=0;
[Code]...
problem is when i try to execute the code it just say create window1- failed!!
I'm writing a Blackjack program where the user can choose to Hit(H) or Stand (S). I would like them to be able to use upper or lower case letter for this. My code doesn't seem to work right for my Stands.
Code: char choice; do { choice = 0; while (choice < 1) { printf("
I am looking at functions still and can't see the point in declaring the function at the top of the program, and then defining later i.e.
Code: #include <iostream> int add (int x, int y) { return x + y;
[Code] .....
I obviously don't have much real world experience with this and am interested to see where declaring and defining later would be useful and/or beneficial.
Is there a program that can remove the functions in a program by preprocessing
Code:
#include<stdio.h> int is_even(int number); int main(void) { if(is_even(number)) { printf("%d is even", number); } }
[Code]...
To something like
Code:
#include<stdio.h> int is_even(int number); int main(void) { if( number%2 ==0 ) { printf("%d is even", number); } }
I use the "-E" option when compiling with gcc on linux but its output still contains funcitons. Is there a preprocessing program that can remove functions from a program?
I have to make a numerical integration program, how I can write my code so that the user is able to write their own function that they want to integrate?
E.g. they would see the message: 'please enter your function' and would be able to write whatever they wanted e.g. 'x +5' then this would then be integrated by the program.
I have already written a program that can integrate a known function but would prefer that the user could choose their own.
I'm writing a program to check whether codes from a file are invalid, valid, inactive, or valid and active, but can't get it to work properly. The invalid codes are being found, but the other three are not. I think it may have something to do with my "active" function.
I want to make a custom program for packaging multiple files in one. Not as complicated as ZLIB or others. Consider few files, XML, txt, JPG, OGG, I want them to be added in 1 file. Not visible not readable. Just a datafile. I have some ideas about creating some kind of indexing of the start byte, end byte of each file. But I am still way too far. Can you point me some direction at what should I stress in creating this software. It will be portable since I am planning to use stdlib, stdio only, maybe and string to recreate the filenames from the large chunk datafile.