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
Ok, so I'm writing this code and when I build it keeps saying cannot implicitely convert type int to string even though I declared my variables as string. Why is it giving me this error?
private static string Repair() { string result=""; string beep; string spin; Console.WriteLine("Does your computer beep on startup?:(y,n)");
In a .h file there is a function that takes in this parameter:
void (^callback)(float * arg)=NULL
as in a function definition:
void func(void (^callback)(float * arg)=NULL);
What I am able to read is that it takes a function pointer and if not defined it overrides with NULL. The part I do not get is the ^ in (^callback). I only know ^ as a bitwise XOR operator. It also generates issues in my VS2012 compiler (something with CLR). So I would really like to rewrite this part to something else, without the bitwise operator...
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 ....
I'm quite new to C and these days I have been playing around with a linked list. I managed to make a working version using pointers, ad only for the sake of learning I was trying to do the same thing just passing the "Object reference" Here is the method that apparently doesn't work..
Code:
struct Node addNode(struct Node head){ int value; struct Node *n; printf("Please enter the value "); scanf("%d", &value);
[Code]...
when I return the function i have something like: head=addNode(head)
Unfortunately it does not work the way I aspect. I suppose that there is something I have left out..
Code: like n->next=&head // passing the address of the head at the next pointer of the struct head =*n //copy the values of the new node to the old head..
There must be something wrong with this line.. return head; What have I done wrong?
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'm VERY new in programming and I'm having trouble converting an integer to string. I need to create a function for a programme I'm working on for my school. My problem is that i am only allowed to use the libraries stdio.h, time.h and stdlib.h as well as printf, scanf, system, srand, time and rand. If I was allowed to use itoa or pointers it would be easier but i am not.
Do I have to use T as a parameter type in order for the compiler to deduce it?
For example this:
template<typename T> T max(T x[], const int& len) { T maximum(x[0]); for(int i = 1; i < len; i++) if(maximum < x[i]) maximum = x[i]; return maximum; }
If I take out the T as type of x[] it will not compile because it can't deduce T right?
Like so
template<typename T> T max(long x[], const int& len) { T maximum(x[0]); for(int i = 1; i < len; i++) if(maximum < x[i]) maximum = x[i]; return maximum; }
I tried and it wouldn't compile but I just wanna make sure that it is necessary that I always have to use my template parameter as a parameter type in order for my compiler to deduce the type?
actually it is the windows application .When i'm running my program it is not allowing me to enter the data into textboxes means the cursor is not appearing
I'm working on a program where I have a vector full of <myClassType> structs.
I'm trying to insert items into a vector, searching first through the vector to make sure the value isn't already in the vector before inserting it. The "find" function isn't working properly.
I keep getting C2678 "binary '==': no operator found which takes a left-hand operand of type "myClassType" or there is no conversion errors in Visual Studio 2010.
I know it's something having to do with the find function and my iterators, but I can't, for the life of me, figure out what it is.
I've tried switching to const_iterators, but I get the same error message.
class T { enum E { } struct S { } interface I { } delegate void D(); class C { } }
[code]....
All of the above are possible except the constant field of a type that is a struct. I can see why the non-string reference types would default to the only literal expression they can represent - null - and if I'm not mistaken the default value of a struct is an instance of the struct with all its fields set to their default value, but why is it that a const struct field is not possible? is there a reason why or is it just the way c# was written? oh and by the way, what's the idea of allowing enum types to have a default constructor?
I am trying to compile the files below. The PosLin.cpp contains the SurTriAuto and SurTriPosRotAndQ functions below. Before adding SurTriPosRotAndQ, it compiled fine, but when I added SurTriPosRotAndQ, I am getting "invalid use of incomplete type ‘struct PosRotAndQ" error messages
I was thinking I could try moving SurTriAuto and SurTriPosRotAndQ to PosLin.h, but since they return "T*", I'm not sure what to do
I have a "t.h" file
namespace TNS { class T {
[Code]....
when I add "include Pos/PL.h" to geopar.h, I get an error saying v.hpp is missing, where v.hpp is part of a 3rd-party software and it is already in my directory
I've been reading the tutorials on Friendship and Inheritance [URL] ..... but I still don't understand why I can't access members of the same struct type.
The code above is located in a source file, where the function isAlphanumeric passes a char value, and Message is the struct containing the string I want to access. Below is the declaration of the struct and string located in the corresponding header file.
My frustration comes when I try to call and assign messageText like the tutorial does to its private members, but I keep getting an error saying I can't access the string because it is a private member. Is there a way to access the string without having to pass it through the function wordBeginsAt?