um i just starded macking a simple program and i want the user to input a number when it says enter a number then i want it to say that number *3 is, enter then the answer will appear here is what i have and i dont know whats wrong with it
#include
using namespace std;
int main(int argc, char **argv)
{
int k,n;
n = k*3;
cout << "type a number";
cout << k << "times three is";
cin>>n;
system ("pause"); /* execute M$-DOS' pause command */
return 0;
)
You haven't even got the user input.
set up variables properly:
int k = 0;
int n = 0;
prompt the user:
cout << "type a freaking number --> ";
get the input
cin >> k;
multiply by three:
n = k*3;
then display the new result:
cout << endl << n;
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
You haven't even got the user input.
set up variables properly:
int k = 0;
int n = 0;
prompt the user: < "; <> k;
multiply by three: <
I don't think that compiles without errors?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
I don't think that compiles without errors?
Wow. Your stupidity becomes more prevalent with each post. I know you're still pissed about me letting you know how stupid your other post is, but that's not reason to carry over into someone elses thread. If you have a problem, then PM me and stop your fagish whining.
server_crash
Postaholic
2,111 posts since Jun 2004
Reputation Points: 113
Solved Threads: 20
Wow. Your stupidity becomes more prevalent with each post. I know you're still pissed about me letting you know how stupid your other post is, but that's not reason to carry over into someone elses thread. If you have a problem, then PM me and stop your fagish whining.
It's a joke my friend, I better stop becauseyour fagish whining is getting me and everyone else depressed.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Try this?
#include <iostream>
using namespace std;
int main()
{
int k,n;
k = 0;
n = 0;
cout<<"type a number";
cin>>k;
n=k*3;
cout<<endl<<n;
system ("pause"); /* execute M$-DOS' pause command */
return 0;
}
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Okay children, stop the name calling!
grunge man, you forgot to iclude #include <cstdlib> // system()
#include <iostream> // cout, cin, endl
using namespace std;
int main()
{
int k, n;
cout<<"type a number: ";
cin >> k;
n = k*3;
cout << "\ntimes three = " << n << endl;
system("PAUSE");
return EXIT_SUCCESS; // optional with C++
}
Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
use code tags anytime you are posting code to the board (or even text that you want to preserve indentation on as the board will eat it up otherwise)
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396