User Profile
Collapse
-
Could you potentially direct me to reading material on C++/CLR? I haven't found any books or tutorials on the subject. -
C++/CLR classes between forms?
I was wondering how, in a c++/clr project you pass a class to one form, and then return it to the original form? -
vc++ Form enable/disable
I'm writing a program in Visual C++ which uses multiple forms which are activated through a menu option, when a new form is opened the main form is disabled. I am having problems getting the main form to enable once the new form is closed. -
counting vars
I was wondering how to simplify my overly large if statement in the code below, I would appreciate any advice.
Code:int main(int argc, char *argv[]) { int numofvar= 0; int totalnumofvar = 0, i, j; string str; gs(str); for(i = 0; i<str.length();i++) { if(str[i] != '1' && str[i] != '2' && str[i] != '3' && str[i] != '4' && str[i] != '5' &&
-
Well for some reason I'm not running into it now, does the system I'm compiling/running on effect that somehow?
Also I was wondering whether this
Code:void getstring(string& ptr) { getline(cin, ptr); } int main() { string * ptr; string mystring; ptr = &mystring; getstring(*ptr); }
Code:string
Leave a comment:
-
I found my own answer, the problem wasn't in getline, but in the variable I was referencing, for some reason my compiler didn't catch that I had a declared pointer "mystring" and a declared string "mystring" in the same function. So I wrote the getstring() function separately as
Code:string getstring() { string input; getline(cin, input); return input; }
Leave a comment:
-
cin.ignore() causes the function to eat the first character of every string after the first string, and I have no idea why. The upside is it is now providing me with strings instead of random ascii symbols....Leave a comment:
-
It doesn't work correctly after multiple implementations , if I use, getline(cin, string); more than three times or so it begins to spit out random errors, and if I use it in a function that is implemented several times it spits out gibberish....Leave a comment:
-
Getting input the rightway?
I've recently started working with C++ and wondered if there was a "right" way for getting input from the console window. From what I've seen whenever I attempted to implement it more than once, cin>>string seems to fail on items of the "string" type. The use of getch()/scanf() isn't really satisfactory because getch() requires lots of garbage add ons to recognize the end of the string, and backspacing, while scanf() seems...
No activity results to display
Show More
Leave a comment: