collapse collapse

* Who's Online

  • Dot Guests: 124
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Author Topic: SOLVED: jackinthebox's needed help topic  (Read 8889 times)

0 Members and 1 Guest are viewing this topic.

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
SOLVED: jackinthebox's needed help topic
« on: January 16, 2009, 04:58:01 pm »
ya well i know idk if im allowed to do this or not but
this way i get to see wat im doing wrong n ask wats wrong with wat im doing

#include <iostream>
using namespace std;

int main() {
   string strName = "tim";

   cout << "hey kid, wats your name? : ";
   cin >> strName = "tim";
   cout << "so your name is " << " Eh?" << endl;

   getchar();
   return 0;
}


Wats wrong with that?
« Last Edit: January 18, 2009, 05:54:10 pm by Celestialkey »

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: jackinthebox's needed help topic
« Reply #1 on: January 16, 2009, 05:03:52 pm »
Use code tags.
[ code ]
// code
[ /code ]
Your missing a include file.

#include <string>

You then need to fix your data input area.
Code: [Select]

   cin >> strName = "tim";
// change it to

   cin >> strName;

Last, you need to print your variable properly
Code: [Select]
   cout << "so your name is " << strName << " Eh?" << endl;
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #2 on: January 16, 2009, 05:37:21 pm »
ok whats with the code tags?

error C2065: 'cout' : undeclared identifier
error C2065: 'cin' : undeclared identifier
error C2065: 'cout' : undeclared identifier
« Last Edit: January 16, 2009, 05:53:15 pm by Jackinthebox »

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: jackinthebox's needed help topic
« Reply #3 on: January 16, 2009, 06:03:24 pm »
On the forum, when your posting your code. You use code tags
[ code]
[ /code]
without the spaces, put your code inbetween them.
And your problem is your not including iostream, or your not adding 'using namespace std;'
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #4 on: January 16, 2009, 06:18:38 pm »
Code: [Select]
#include <iostream>
using namespace std;

int main() {
string strName= "tim";

cout << "hey kid, wats your name? : ";
cin >> strName;
cout << "so your name is " << strName << " Eh?" << endl;

getchar();
return 0;
}
nothing happens

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: jackinthebox's needed help topic
« Reply #5 on: January 16, 2009, 06:24:52 pm »
Code: [Select]
#include <iostream>
using namespace std;

int main() {
string strName= "tim";

cout << "hey kid, wats your name? : ";
cin >> strName;
cout << "so your name is " << strName << " Eh?" << endl;

getchar();
return 0;
}
nothing happens

Mind giving more information then 'nothing happens'?
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #6 on: January 16, 2009, 06:27:25 pm »
um i put everything your one tutorails says n it doesnt seem to do anything

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: jackinthebox's needed help topic
« Reply #7 on: January 16, 2009, 06:30:25 pm »
Meaning?
General Questions answered.
Did it build successfully?
--- It should have.

Did it run successfully?
--- It should have.

Did it end abruptly?
--- It may have, if it did, add a #include <windows.h>, then add a system("pause"); before getchar();
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #8 on: January 16, 2009, 06:31:36 pm »
meaning i got the command promt window but blank
srry i just dont have any other way to explain it
« Last Edit: January 16, 2009, 06:34:24 pm by Jackinthebox »

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #9 on: January 16, 2009, 09:33:58 pm »
meaning i got the command promt window but blank
srry i just dont have any other way to explain it
Please upload the source.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #10 on: January 17, 2009, 09:31:29 am »
huh? ???  ???  ???  ???
srry just woke up

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #11 on: January 17, 2009, 09:46:41 am »
huh? ???  ???  ???  ???
srry just woke up
Reply and click "Additional Options", click browse and attack your source.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #12 on: January 17, 2009, 11:46:25 am »
i think this is wat u mean

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: jackinthebox's needed help topic
« Reply #13 on: January 17, 2009, 12:34:59 pm »
Lulz. Nice try, but no. He means, upload the folder that your project file is stored in.
It will be located in your Documents and Settings / Visual C++ 6.0/ Projects
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #14 on: January 17, 2009, 02:04:49 pm »
You can post your code but attachments make the forum 'neater'.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #15 on: January 17, 2009, 03:02:48 pm »
u know u cant upload a folder rite?

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #16 on: January 17, 2009, 03:05:25 pm »
u know u cant upload a folder rite?
Yes, but you can zip files and upload that.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #17 on: January 17, 2009, 03:07:13 pm »
u said folder not a rar file
but here u go

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #18 on: January 17, 2009, 03:14:05 pm »
Perfect!

First off you should include the string library, second is that you need to clear the input stream buffer by using cin.clear(), now getchar() will work (I guess this is a reason TO use system("pause") but that's for another thread!).

Attached is the fixed source.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

Offline Jackinthebox

  • Jr. Member
  • **
  • Posts: 74
  • Reputation 91
  • Gender: Male
    • View Profile
    • DDWO
Re: jackinthebox's needed help topic
« Reply #19 on: January 17, 2009, 03:18:33 pm »
so how does this work anyways i put in tim but than wat
srry not use to this stuff yet

Offline Nathan

  • Administrator
  • Hero Member
  • *
  • Posts: 1437
  • Reputation 1768
  • Gender: Male
  • woof woof
    • View Profile
Re: jackinthebox's needed help topic
« Reply #20 on: January 17, 2009, 03:22:19 pm »
so how does this work anyways i put in tim but than wat
srry not use to this stuff yet

All I added was #include <string> and cin.clear();
Compare my source with yours.
Projects:
[ Axios Engine ] [ sourcehub ]
Compilers: Microsoft Visual Studio 2008, GNU C++, FASM, MASM, VB 6/.Net.
Languages: C++, PHP, ASM, JS, VB6/.Net, BASIC, HTML, MySQL
Please buy me some books: Amazon Wishlist

 

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]