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.
#include <iostream> #include <iomanip> using namespace std;
// Function Prototype void sortArray(int array[], int size);
[Code] ....
This program was made to allow students to enter as many test scores as they want and the program will show them in ascending order and then will calculate the average of all test scores. It works wonderful until you enter a negative test score and then it throws the averaging process off. I can't seem to be able to make the program not accept the negative numbers.
p6.c.text+0x6a): undefined reference to 'palindromeness' collect2: 1d returned 1 exit status
This is program is suppose to check if a phrase is a palindrome or not.I need to write a function definition for _Bool palindromeness(char str[])but I am having a tough time figuring that part out. I am brand new to programming..this is my first class and I am just learning arrays and pointers.
So I've been tasked with creating a program that checks to see whether or not a string is a palindrome. It has to remove whitespace, punctuation, and capitalization for obvious reasons. Getting some errors which I'm not sure how to correct.
On an unrelated note, while programming in the console, my cursor has turned into a gray box and replaces characters when typing, instead of pushing them forward, etc. How do I return it to normal?
Program is supposed to check for balanced parentheses which are (), {}, [] using a vector First read in the number of lines user wishes to testReturn Yes if balanced, No if unbalanced. Missing conditions to check for unbalanced parentheses Program doesn't catch left parentheses returns YesPairs wrong parentheses together, (} returns Yes, should be No Cases with incorrect output (}, (], ))), }}}, ]]], just a space or nothing entered. how I can correctly catch the cases I've missed
Code:
#include <stdio.h> #include <stdlib.h> #include "char_vector.h" int main( int argc, char * argv []) { int i, num; char c; scanf("%d", &num); scanf("%c", &c);
So I have to write a program that outputs a check with correct spacing and everything.
Create a project titled Lab7_Check. Write a program that asks the user the check information and prints the check. The dialog should be as follows:
date: 2/23/2010 name: William Schmidt amount, dollars: 23 cents: 30 payee: Office Max
your check:
William Schmidt 10/13/2013 pay to: Office Max $23.30 twenty three and 30/100 dollars
You may assume that a person always has the first name and last name (no middle names or initials). The payee name is also always two words. The dollar and cent amount are integers and the amount is always less than 100 dollars. Note that the dollar amount could be zero, in which case, when you spell the dollar amount, it should print "zero". The date is always a single (non-white space separated string). Your date, dollar amount in numbers and the word "dollars" have to vertically align.
This is the code I have so far.
#include <iostream> #include <string> using namespace std; int main(){ string date; string firstname; string lastname;
add more code given bellow program that means (( you can input a password and the output checking the password is valid or not and also the password is hard or weak)) the program,s output show....the given password is too strong or strong or weak and also check the password is valid
I am new to C++ and am stuck on a program. I've got to create a password check program that makes sure the password rules are followed. Below is the code and the rules i have typed in the comments at the beginning of the program. I have to use loops and cant use arrays for this.
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { //Prompt user to entered a password to be tested cout << "Password must be at least 8 characters long." << endl;
I have written a program which uses a pid to check if the process is currently running and return a value based on the system call result.But the program core dumps
Code:
#include <stdio.h> #include <string.h int main( argc, argv ) int argc; char * argv[]; { int p_pid = 99; char buff[1000]; }
[code]....
What is the mistake in this code and is it portable in both unix/linux , is the method secure (grepping for program name )?
Write a program that will search soccer players data to check whether a name supplied by the user is on that list. For doing the search, the user may provide either the player’s full last name or one or more starting letters of the last name. If a matching last name is found, the program will display the player’s full name and date of birth. Otherwise, it will display “Not found”.
Requirements specification:At the start, the program will ask the user to enter information about 10 soccer players constituting soccer player data. Each soccer player data will consist of the following fields:
Last name First name Birth month Birth day Birth year
The user will be asked to enter each soccer player data on a separate line with the field values separated by a space.
Once the data is entered, the program will display a menu of choices as below:
Chose an option:
(1 – input data, 2 – display original data, 3 – sort data , 4 – display sorted data 5 – search by last name 6 – exit the program )
If the user chooses option 1, the program will ask the user for a data and populate the array of structures that will hold the data for each of the soccer players.
If the user chooses option 2, the program will display data in the order provided by the user (original data).
If use chooses option 3, the program will sort data by last name.
If user chooses number 4 the program will display the data sorted by last name.
If the user chooses option 5, the program will ask the user to enter one or more starting letters of the soccer player’s last name. It will then search the soccer player data for the matching last name. If a match is found, it will display the first player found with the matching pattern. If a match is not found, the program will display “Not found”. If the user enters two forward slashes (//) for the last name, it will no longer search for the name. Instead it will display the main option menu.
If the user chooses option 6, the program will display “Thank you for using this program” and will end.
Why my program isint executing correctly. Here is what i've so far . . . .
#include <iostream> #include <string> using namespace std; struct data { string lname; string fname; int birthmonth; int birthday; int birthyear;
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 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.
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'm working on a parallel Fortran program by using MPI, which calls a very good random number generator function from C (drand48 and srand48 for seed).
My Fortran program file "Par_PICFort_4.f95" is smt. like:
Code: PROGRAM main IMPLICIT NONE Include 'mpif.h'
[Code]....
I compile the code as: Code: mpif77 -o PIC Par_PICFort_4.f95 drand48.c Program seem to be running, but after checking the simulation results, I see that drand48 is not working in a parallel way. Creating independent random numbers which different seeds is very important for me.
Question: Is it possible to run the drand48.c file as parallel?