Does anyone knows the code to create a simple windows where you can write texts???? Help me! I am using Visual Studio 2005 C++
C++! Help!?
Asking a lot there in a simple question. There are two type of applications, win32 console applications (command prompts), and win32 MFC\Window applications - (forms).
I suggest reading up on the subject, I'm guessing you'll eventually want to do more then just display text, I'd start with the MSDN help: http://msdn2.microsoft.com/en-gb/visualc...
Saturday, May 9, 2009
C++ help....................!!!!!!...
make a game in which a number is randomly chosen. then the user types any no. if the is larger it displays "larger"and similarly smaller.You have only 10 guesses.If the number is guesed It should display "WINNER"
Pleez help me if u know the answer
also tell me from where I can download C++ which runs as a dos program.
C++ help....................!!!!!!...
i will give you a site that i am using as a refference of my projects..... Try it and search for guessing game and choose the C++ language.... Hope it will help you....
Reply:#include %26lt;iostream%26gt;
#include %26lt;ctime%26gt;
using namespace std;
int main()
{
cout %26lt;%26lt; "enter a number: ";
int guess;
cin %26gt;%26gt; guess;
srand(time(0));
int num = rand() % 100;
int guesses = 1;
while (guess != num %26amp;%26amp; guesses != 10) {
if(guess %26gt; num)
cout %26lt;%26lt; "larger" %26lt;%26lt; endl;
if(guess %26lt; num)
cout %26lt;%26lt; "smaller" %26lt;%26lt; endl;
cin %26gt;%26gt; guess;
guesses++;
}
if(guess == num)
cout %26lt;%26lt; "WINNER" %26lt;%26lt; endl;
else
cout %26lt;%26lt; "the number was " %26lt;%26lt; num %26lt;%26lt; endl;
return 0;
}
Pleez help me if u know the answer
also tell me from where I can download C++ which runs as a dos program.
C++ help....................!!!!!!...
i will give you a site that i am using as a refference of my projects..... Try it and search for guessing game and choose the C++ language.... Hope it will help you....
Reply:#include %26lt;iostream%26gt;
#include %26lt;ctime%26gt;
using namespace std;
int main()
{
cout %26lt;%26lt; "enter a number: ";
int guess;
cin %26gt;%26gt; guess;
srand(time(0));
int num = rand() % 100;
int guesses = 1;
while (guess != num %26amp;%26amp; guesses != 10) {
if(guess %26gt; num)
cout %26lt;%26lt; "larger" %26lt;%26lt; endl;
if(guess %26lt; num)
cout %26lt;%26lt; "smaller" %26lt;%26lt; endl;
cin %26gt;%26gt; guess;
guesses++;
}
if(guess == num)
cout %26lt;%26lt; "WINNER" %26lt;%26lt; endl;
else
cout %26lt;%26lt; "the number was " %26lt;%26lt; num %26lt;%26lt; endl;
return 0;
}
C++ help?!?!?
Well, i have another c++ issue. I have this program completly written out and it should work but for some reason it says x and y are undefined? Please help!?
#include%26lt;iostream%26gt;
using namespace std;
struct point
{
int x;
int y;
};
void greeting();
//Displays greeting.
int main()
{
point p1, p2, p3;
greeting();
cout %26lt;%26lt; "Please enter coordinates for point one: ";
cin %26gt;%26gt; x.p2 %26gt;%26gt; y.p2;
cout %26lt;%26lt; "Please enter coordinates for point two: ";
cin %26gt;%26gt; x.p2 %26gt;%26gt; y.p2;
x.p3 = x.p1 + x.p2;
y.p3 = y.p1 + y.p2;
cout %26lt;%26lt; "The coordinates of point three are: " %26lt;%26lt; x.p3 %26lt;%26lt; y.p3;
system("pause");
return 0;
}
void greeting()
{
cout %26lt;%26lt; "This program will take in two points the user enters and compute a "
%26lt;%26lt; "third point.\n\n";
}
C++ help?!?!?
I think you're accessing the structure members backwards. You allocated 3 structures (p1-p3). When you need to access a structure member, the structure member goes on the right side of the '.' character and the name of the structure goes on the left side.
Example:
p3.y=p1.y + p2.y;
Reply:X and Y must be set to a value. Try setting them both to zero at the start.
int x =0;
int y =0'
Reply:replace x.p2 by p2.x and so on
#include%26lt;iostream%26gt;
using namespace std;
struct point
{
int x;
int y;
};
void greeting();
//Displays greeting.
int main()
{
point p1, p2, p3;
greeting();
cout %26lt;%26lt; "Please enter coordinates for point one: ";
cin %26gt;%26gt; x.p2 %26gt;%26gt; y.p2;
cout %26lt;%26lt; "Please enter coordinates for point two: ";
cin %26gt;%26gt; x.p2 %26gt;%26gt; y.p2;
x.p3 = x.p1 + x.p2;
y.p3 = y.p1 + y.p2;
cout %26lt;%26lt; "The coordinates of point three are: " %26lt;%26lt; x.p3 %26lt;%26lt; y.p3;
system("pause");
return 0;
}
void greeting()
{
cout %26lt;%26lt; "This program will take in two points the user enters and compute a "
%26lt;%26lt; "third point.\n\n";
}
C++ help?!?!?
I think you're accessing the structure members backwards. You allocated 3 structures (p1-p3). When you need to access a structure member, the structure member goes on the right side of the '.' character and the name of the structure goes on the left side.
Example:
p3.y=p1.y + p2.y;
Reply:X and Y must be set to a value. Try setting them both to zero at the start.
int x =0;
int y =0'
Reply:replace x.p2 by p2.x and so on
C++ help??
im using visual c++ but the include file windows.h is missing!!
i dunno what to do!
please help!!
C++ help??
Have you tried Googling it?
If its a missing file, then I suppose you could download it from somewhere and putting it where its supposed to be.
I'm not a VC++ expert, so I can't help all that much. You should have made the title of the question "VC++ Help" because they are two different languages.
Reply:uh
wedding reception flowers
i dunno what to do!
please help!!
C++ help??
Have you tried Googling it?
If its a missing file, then I suppose you could download it from somewhere and putting it where its supposed to be.
I'm not a VC++ expert, so I can't help all that much. You should have made the title of the question "VC++ Help" because they are two different languages.
Reply:uh
wedding reception flowers
C++ help!!?
I want to print using cout with an argument.. if the argument returns a true print this, if it returns this print this.
Don't use IFs.. I think it's something like this...
cout %26lt;%26lt; (argument) ? : "hello" : "bye";
that doesn't compile, but the syntax is something like that.
C++ expert please help.
C++ help!!?
drop the : between ? and "hello", i.e.
(argument) ? "hello" : "bye"
This syntax is also supported in many other languages beside C/C++.
However, in the business world, it is often considered a security risk for reasons I have yet to comprehend.
Reply:cout %26lt;%26lt; (argument) ? : "hello" : "bye";//its wrong
cout %26lt;%26lt; (argument) ? "hello" : "bye";//use this
Reply:previous answerer is correct. Just follow him. The line should compile.
cout%26lt;%26lt; (arguement)? "print this" : "otherwise print this ";
Reply:It's not an argument. An argument is a parameter to a function, and you're not calling a function.
It's:
cout %26lt;%26lt; ((expression) ? "hello" : "byte");
Don't use IFs.. I think it's something like this...
cout %26lt;%26lt; (argument) ? : "hello" : "bye";
that doesn't compile, but the syntax is something like that.
C++ expert please help.
C++ help!!?
drop the : between ? and "hello", i.e.
(argument) ? "hello" : "bye"
This syntax is also supported in many other languages beside C/C++.
However, in the business world, it is often considered a security risk for reasons I have yet to comprehend.
Reply:cout %26lt;%26lt; (argument) ? : "hello" : "bye";//its wrong
cout %26lt;%26lt; (argument) ? "hello" : "bye";//use this
Reply:previous answerer is correct. Just follow him. The line should compile.
cout%26lt;%26lt; (arguement)? "print this" : "otherwise print this ";
Reply:It's not an argument. An argument is a parameter to a function, and you're not calling a function.
It's:
cout %26lt;%26lt; ((expression) ? "hello" : "byte");
C++ Help!!!?
I have a final due pretty soon, and I need to work on it at home. But i cannot find any C++ Programs that program anything similar to the one we use in class.
For example, ussually the header we use is
#include %26lt;iostream.h%26gt;
and using:
cout %26lt;%26lt; "Example" %26lt;%26lt; '\n';
All the other C++ programs i found were all way diffrent, PLEASE help me T.T
C++ Help!!!?
All first three answerers are right! You are actually using the old compiler. I am using the old compiler. But you need not to worry because the more it is improved, the better. There are slight changes in the new compiler like the loss of .h extension to all library header files, the use of namespace, the presence of vector (I think vector is cool compared to array) and so many more...
Reply:the program you are writing should be :
#include %26lt;iostream%26gt; // provide input and output
#include %26lt;cstdlib%26gt; // provide standard library
using namespace std;
//main driver start
int main (){
cout %26lt;%26lt; "Example \n"; //print the the word "Example " \n to newline.
return EXITSUCCESS;
} //end program
from
keng ping kong from www.iwohoo.com and www.pinkeikong.com
Reply:%26lt;iostream.h%26gt; will compile with gcc2.95.* compilers
You just have to choose the right compiler or else use %26lt;iostream%26gt;
Reply:thats because the compiler is old as crap... i ran into the same problem when i upgrade my compiler.
Reply:You can use the gcc program that comes with cygwin, and add the option -Wno-deprecated when compiling -- and it will support the code like you have shown above.
Cygwin is a free product, available at www.cygwin.com
When installing, you will need to install the gcc/g++ compiler option under "development".
For example, let's say you create this program named "example.cpp" in C:\ using notepad:
#include %26lt;iostream.h%26gt;
using namespace std;
int main()
{
cout %26lt;%26lt; "Example";
return 0;
}
Once you start cygwin by clicking on the icon, you will navigate to where you saved your file:
cd /cygdrive/c
Then you will compile:
gcc -Wno-deprecated example.cpp -o test.exe
And now you can run test.exe:
./test.exe
That should be all you need.
For example, ussually the header we use is
#include %26lt;iostream.h%26gt;
and using:
cout %26lt;%26lt; "Example" %26lt;%26lt; '\n';
All the other C++ programs i found were all way diffrent, PLEASE help me T.T
C++ Help!!!?
All first three answerers are right! You are actually using the old compiler. I am using the old compiler. But you need not to worry because the more it is improved, the better. There are slight changes in the new compiler like the loss of .h extension to all library header files, the use of namespace, the presence of vector (I think vector is cool compared to array) and so many more...
Reply:the program you are writing should be :
#include %26lt;iostream%26gt; // provide input and output
#include %26lt;cstdlib%26gt; // provide standard library
using namespace std;
//main driver start
int main (){
cout %26lt;%26lt; "Example \n"; //print the the word "Example " \n to newline.
return EXITSUCCESS;
} //end program
from
keng ping kong from www.iwohoo.com and www.pinkeikong.com
Reply:%26lt;iostream.h%26gt; will compile with gcc2.95.* compilers
You just have to choose the right compiler or else use %26lt;iostream%26gt;
Reply:thats because the compiler is old as crap... i ran into the same problem when i upgrade my compiler.
Reply:You can use the gcc program that comes with cygwin, and add the option -Wno-deprecated when compiling -- and it will support the code like you have shown above.
Cygwin is a free product, available at www.cygwin.com
When installing, you will need to install the gcc/g++ compiler option under "development".
For example, let's say you create this program named "example.cpp" in C:\ using notepad:
#include %26lt;iostream.h%26gt;
using namespace std;
int main()
{
cout %26lt;%26lt; "Example";
return 0;
}
Once you start cygwin by clicking on the icon, you will navigate to where you saved your file:
cd /cygdrive/c
Then you will compile:
gcc -Wno-deprecated example.cpp -o test.exe
And now you can run test.exe:
./test.exe
That should be all you need.
C++ help???????
i am new to c++. it is just 1 week since i started learning about it. i don't really understand a bit. students in my class can write programs in c++ and i can't. can someone please teach me c++ or refer me an online guide which is easy to understand. please help me.
C++ help???????
I am writing a tutorial on C++ at http://www.learncpp.com
It's not complete yet, but it will get you started.
Also try googling "C++ tutorial" and you will come up with a lot of results.
Reply:%26gt; i am new to c++. it is just 1 week since i started learning about it.
Then you have a long way to go. C++ has a long learning curve because it is a complex language. Don't rush trying to learn it.
%26gt; students in my class can write programs in c++ and i can't.
They may already have prior exposure.
%26gt; can someone please teach me c++
No. No professional will sit down and tutor you. That is not how critical thinkers work. You're expect to exhibit initiative and critical thinking. If you don't do so, you will be written off as a lost cause.
%26gt; refer me an online guide
Cprogramming.com and cplusplus.com .
You might want to consider buying a book. C++ Primer (4th Edition) by Lippman and Accelerated C++ by Koenig are written by C++ gurus and are intended for people who really want to learn C++.
Also, google for C FAQ and C++ FAQ.
Reply:Try this site: http://search.msdn.microsoft.com/search/...
It is a search query for C++ on Microsoft.com. About C++ itself, though, I also don't know a whole lot about it; I'm working on Visual Basic as it is. Matter of fact, use Visual Basic if you have it (available programming 'demos' - to say - on Microsoft Office programs, such as FrontPage, in the menu). It's easy and interesting to learn; it's a good place to start. Then, try C++.
Well, that's my advice. I hope this helps!
C++ help???????
I am writing a tutorial on C++ at http://www.learncpp.com
It's not complete yet, but it will get you started.
Also try googling "C++ tutorial" and you will come up with a lot of results.
Reply:%26gt; i am new to c++. it is just 1 week since i started learning about it.
Then you have a long way to go. C++ has a long learning curve because it is a complex language. Don't rush trying to learn it.
%26gt; students in my class can write programs in c++ and i can't.
They may already have prior exposure.
%26gt; can someone please teach me c++
No. No professional will sit down and tutor you. That is not how critical thinkers work. You're expect to exhibit initiative and critical thinking. If you don't do so, you will be written off as a lost cause.
%26gt; refer me an online guide
Cprogramming.com and cplusplus.com .
You might want to consider buying a book. C++ Primer (4th Edition) by Lippman and Accelerated C++ by Koenig are written by C++ gurus and are intended for people who really want to learn C++.
Also, google for C FAQ and C++ FAQ.
Reply:Try this site: http://search.msdn.microsoft.com/search/...
It is a search query for C++ on Microsoft.com. About C++ itself, though, I also don't know a whole lot about it; I'm working on Visual Basic as it is. Matter of fact, use Visual Basic if you have it (available programming 'demos' - to say - on Microsoft Office programs, such as FrontPage, in the menu). It's easy and interesting to learn; it's a good place to start. Then, try C++.
Well, that's my advice. I hope this helps!
Subscribe to:
Posts (Atom)