I have a school project in which need to create a function that takes a File Object as a Reference Parameter. Supposedly, it should allow me to read the first piece of data from others separated by a space from a file. The later be able to continue reading from the next piece of data.
I know how to set things up to read from the data file, such as using
I have a function (name Callback), with take some parameter( name Arg). I want to create it before, pass it to other class ( class B). And in class B, call the Callback function with Arg paramater. It's something like this:
class A { void A::doSomething(int a, bool b){//dosomething}; void A::setCallback(B b) {//I don't know how to do this};
[Code].....
How can i do this? And what happen with I want B can get more type of callback function, which mean I don't know the type of Callback's paramater?
I have some code here where I try to declare a struct then pass it as a parameter into a function to do something to it:
Code: struct _user { char * initial[3]; int pos; } user; int initial_add (struct user * initial_list, int initials, char * buffer) {
[Code] ...
I get the error : server2.c:15: warning: "struct user" declared inside parameter list server2.c:15: warning: its scope is only this definition or declaration, which is probably not what you want
I have a stored procedure, which I cannot change (it is used by older programs). It is passed an int of 15 and then an ID is generated and written to a database table. The created ID is then suppose to be selected and returned.
The INSERT does not seem to be working. I'm not getting the created ID value from my code, I am getting the value I passed to the procedure when I get to this
line of code "sessionID = sessionProcedureID.Value.ToString()";.
Below the stored procedure and my code.
/***************Stored Procedure***********************/ USE [testDataBase] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[MakeValue]
Write a function palindrome that takes a vector parameter and returns true or false according to whether the vector does or does not read the same forward as backward (e.g., a vector containing 1, 2, 3, 2, 1 is a palindrome, but a vector containing 1, 2, 3, 4 is not).
While running it gives the runtime error: "Extra parameter in call to factorial."
#include<iostream.h> #include<conio.h> int factorial(long int); void main() { clrscr(); long int a; cout<<"This program displays the factorial of the number you enter."<<endl;
I am writing a text-based rpg and I'm having some issues trying to pass the player struct to a function. First, here are the relevant code snippets. Also, Player.c and Player.h aren't completed but the relevant function is. I just run tests every now and then to see if everything is working right.
1. line 33 in Monster.h, the void Attack_Monster_Types(Monster* m, Player* p) the ide says missing ')' before '*', missing '{' before '*' and 'Player' name in formal parameter list illegal
2. line 18 in main.c when the attack function is called. it says 'Attack_Monster_Types' Undefined; assuming extern returning int.
I believe I have all the right headers included so I'm not sure what to do ....
My errors are at the end of the program in two function calls within the definition of the InsertByValue function. g++ does not seem to recognize NumArray as a valid parameter.
#include <iostream> #include <assert.h> using namespace std; const int CAPACITY = 20;
/* Displays the content of an int array, both the array and the size of array will be passed as parameters to the function @param array: gives the array to be displayed @param array_size: gives the number of elements in the array */ void DisplayArray (int array[], int array_size);
The thing is, when I don't create a prototype of count and straightaway define it before void main() my program runs, but it gives error in this program that "extra parameter in call to count()" But what to do then?
I am trying to make a automated menu. It shows there are no syntax errors but when compiled it says cannot convert choice from type into to menuItemType. I am not sure what I did wrong. Here is the code
#include <cstdlib> #include <iostream> using namespace std; struct height { int feet, inches;
[Code] .....
I'm getting a succeed when i try to compile but my grow function is throwing me an warning that the + and - don't work in regards to grow function.
Basically i want it to grow a certain amount of inches specified and format the foot and inches if it goes over a foot. Can i not just add 1 to feet as it's an int? The same goes with inches.
I keep getting this error in my code. I believe it is because to use pow(x,y) both x and y have to be double, but how do i put that into my formula under calculations?
#include <iostream> #include <cmath> #include <iomanip> #include <string> #include <fstream> using namespace std; int main() { // Declaration section: Declaring all variables.
Write a c function which takes a string(as a character array, null terminated) and reverses it. it doesn't print the reversed string -- it modifies the given string so that it is reversed.
I have to make a program that takes several numbers into an array into a function, and send them back into the main function multiplied by 1.13. This is what I have so far:
#include <iostream> using namespace std; void connell(int&n[20]) main() { int num[20];
[Code] ...
I do not know how to get numbers from an array from a main program to a function.
We have to write a function named fibonacci that takes an int indicating the length of the series and then store it in an array of size 20 printing the sequence from largest to smallest. Here is the small bit i have so far:
#include <iostream> #include <iomanip> using namespace std; void Fibonacci( int ); int main( ) {
[Code] ....
I just need something to get me on the right track.
Write a function that takes two input arguments and provides two separate results to the caller, one that is the result of multiplying the two arguments, the other the result of adding them.Since you can directly return only one value from a function, you'll need the second value to be returned through a pointer or reference parameter.
How do I Write a function that takes two linked list as input arguments these linked list contain numbers like this:
num1->3->5->2->NULL (assuming that number 1 is 352) num2->4->3->9->1->NULL (assuming that number 2 is 4391)
The function should return 1 if num1 points to a linked list which represents a smaller number than the number pointed to by num2 linked list. Otherwise, it returns -1. If both linked list point to exactly the same number, returns a 0.
I was required to write a program that takes a baseball players statistics and displays there averages. I was required to make 3 function in the file to perform this tasks. my problem I am having a division problem in the SLG function. My compiler does not require the system ("PAUSE"); command.
OUTPUT The player's batting average is: 0.347 The player's on-base percentage is: 0.375 The player's slugging percentage is: (test)AB = 101 (test)Tot Base = 58 0.000
Code: /* Batting Average Program file: batavg1CPP.cpp Glossary of abbreviations: BA = batting average PA = plate appearances H = hits BB = bases on balls (walks)
error C3867: 'WordParsor::Form1::PutUpfrmIO': function call missing argument list; use '&WordParsor::Form1::PutUpfrmIO' to create a pointer to memberc:userskingc++wordparsorwordparsorForm1.h... and the suggestion fix generate another error.
One person suggested the gcroot<> object wrapper... but I do not know how to modify/declair the function or its argument type.
// RemoteControlMonitor.H typedef void (*keyaction)(unsigned int key);
class RemoteControlMonitor { private: keyaction rph; keyaction rrh;
[Code] .....
But I got compile error as below:
RemoteControlMonitor.H:58: invalid type `void *' for default argument to `void (*)(unsigned int)' rcx1.C: In function `void __static_initialization_and_destruction_0(int, int)': rcx1.C:54: ANSI C++ forbids implicit conversion from `void *' in default argument
int *buildTrail(int antIndex, int start, double *pheromones) { int *trail = new int[tabu]; bool *visited = new bool[tabu]; trail[0] = start; visited[start] = true;
[Code] ....
If I comment all lines includes visited word , no exception occurs , Otherwise , exception throws.
Simply put , How can i delete visited parameter as long as its role has been finished? . . . delete visited ; return trail;