Thanks for reply, but how to move form managed C++ to std C++? Where can I find it out? What should I install or include? I know there must be something that provide these essential conversions.
Can you explain it more please?
User Profile
Collapse
-
VC2005, please help me with TextBox and Label controls
Hi all,
I simply cant manage to read / write value from controls (TextBox, Label ...) in Visual C++.
I am new to Visual C++ so please explain! How to get a value from user (TextBox) into my char* or int type variable and how to print it out (Label) ?
I found out I can do:
String^ str = "Hello";
label1->Text = str;
but nothing more.
Why does microsoft... -
working with System::String^ in visual c++, help please!
Hi all,
Funny, but I simply cant manage to read / write value from Controls (TextBox, Label ...) in Visual C++.
I am new to Visual C++ so please explain! How to get a value from user (TextBox) into my char* or int type variable and how to print it out (Label) ?
I found out I can do:
String^ str = "Hello";
label1->Text = str;
but nothing more.
Why... -
Hi,
first code:
Code:int i, j = 1; while (i = j, j++ <= 5) { while (i <= 5) cout << i++ << " "; cout << endl; }
Code:int i, j = 5; while (i = j--) { while (i) cout << i-- << " "; cout << endl; }
Leave a comment:
-
hi
int puts (const char * string ); is prototype and
return value is either non-negative on success or EOF on error.
Theres no reason for error occuring in program above so !puts() equal to 0. Which means it is actually return 0; then and thats the correct way the main function should always end.Leave a comment:
-
Hi
Before you start calling class member functions to enter name, cost, quantity you have to implement their definitions. What you have so far are function prototypes only.
When you are done call your functions trough objects in main program:
Code:int main() { FastFood employee; // create class object // calling member functions example: employee.enterItemName( "text"
Leave a comment:
-
Hi
This code will read from your binary file "vvv.ecc" and store binary representation of its bytes in "out.txt"
for example:
vvv.ecc :
abcdefgh
out.txt:
01100001 01100010 01100011 01100100 01100101 01100110 01100111 01101000
Code:#include <iostream> #include <fstream> using namespace std; int main
Leave a comment:
-
thanks for good idea D_C
I was actually thinkin how to get count of digits of integer number.
(int)log10 works fine, so I upgraded my function:
void print(const int& x, int n) {
while(--n > (int)log10(x)) cout << 0;
cout << x;
}Leave a comment:
-
Hi
If your function doesnt have to return string composed of numbers you passed to it, in another words If you just need to print out the numbers to screen I would recommend you:
in C use printf :
int i = 5, j = 15;
printf("%02d", i);
printf("%d", j);
in C++ you can use cout in your function:
Code:#include <iostream> using namespace
Leave a comment:
-
casting to int and floor(float) difference
Hi all
Is there any other difference except return type between
(int)a and floor(a) ?
a is float type variable
Thanks -
Hi Faith
I found some bugs in code I posted above before. But this one here works perfect:
Code:#include <stdio.h> #include <math.h> #define PRECISION 20 // 5 9 17 33 (if bottom fraction part has to be 2 4 8 16 32 ...) /*int is2PowN(int x) { while(!(x%2)) x >>= 1; return x==1 ? 1 : 0; }*/ int main() { float mm, inches;
Leave a comment:
-
Hi
Here is the code that convert mm to ft. and it shows inches in fractions:
Code:#include <stdio.h> #include <math.h> #define PRECISION 20 int main() { float mm; float answer; while(1) { printf("\nPlease enter your metric millimeter (0 to exit program): "); scanf("%f", &mm);
Leave a comment:
-
Hi
Here is code for your student class:
Code:#include <iostream> #include <sstream> using namespace std; class S { char _name[32]; int _age; char _sex; public: S(char* str) { stringstream s(str); s >> _name >> _age >> _sex; } void
Leave a comment:
-
Hi
I am using g++ and including <math.h>, everything works fine.
Have you tried pow instead of powf ?
pow is overloaded for float arguments too
Code:#include <iostream> #include <math.h> using namespace std; int main () { float x, y, z; x = 2.1; z = 2.5; cout << powf ( x, z ) << endl;
Leave a comment:
-
I didnt know that. Why is not 1900 leap if 2000 leap is?
anyway, the probability for user to enter such a date is 1:36500, however I believe you Banfa that 1900 is not leap and here is the correction:
Code:case 2: if (0<day && ((day<=29 && !(year%4) && year) || (day<=28 && (year%4 || !year)))) {printDay(day); cout << "february";}
Leave a comment:
-
Hi
Yes memset is best method, I didnt know about it :) . However it is usefull only for arrays of chars. What if you want to initialize array of int numbers or long numbers or any other fundamental type to the other value than 0 ? (memset would manage it with zeros of course)
I agree that zero initialization is used most often, so most of the time memset is perfect solution, however for non zero value and non char array...Leave a comment:
-
Hi Nor farhana yaakub
You are lucky guy. I have written whole program for you, but next time you do it yourself ok?
Here is the code:
Code:#include <iostream> using namespace std; char* int0_9ToStr(int i, bool ordinal) { char* n[] = {" ", "one", "two", "three" ,"four", "five", "six", "seven",
Leave a comment:
-
hi fellows,
jerico wondered how to get greatest of 3 numbers without using the comparison operator and I actually see three of them in this pukur123's statement:
max=(a>b)?((a>c )?a:c): ((b>c)?b:c);
well, here is my solution (works for unsigned integer values):
Code:int getMax(unsigned a, unsigned b, unsigned c) { int m=0; while((a?a--:0)+(b?b--:0)+(c?c--:0)) m++;
Leave a comment:
-
-
sorry i made mistake at the begin of my previous post above
what you tried in first program was not accessing class private members from inside of another class, but it was accessing them from inside of global function. Each of your classes there have a friendship with wrong function.
exchange the lines 11 and 20 in your programLeave a comment:
No activity results to display
Show More
Leave a comment: