User Control Panel
Search iVirtua
Advanced/Tag Search...
Search Users...
What is iVirtua Exclusive Community?
  • An exclusive gaming industry community targeted to, and designed for Professionals, Businesses and Students in the sectors and industries of Gaming, New Media and the Web, all closely related with it's Business and Industry.
  • A Rich content driven service including articles, contributed discussion, news, reviews, networking, downloads, and debate.
  • We strive to cater for cultural influencers, technology decision makers, early adopters and business leaders in the gaming industry.
  • A medium to share your or contribute your ideas, experiences, questions and point of view or network with other colleagues here at iVirtua Community.
Guest's Communication
Live Chat
Teamspeak (VOIP) Audio Conference
Private Messages
Check your Private Messages
Themes
Choose an iVirtua Community theme to reflect your interests...
Business Theme
India/Arabic Theme

Gaming Theme
iVirtua Recommends
Fly Emirates Advertising
C++
Digg This Digg Topic Tag it on del.icio.us Tag topic on On del.icio.us Technorati Search Technorati Search Post to Slashdot Post to Slashdot
You are currently in Programming, Web and Software Design/Development
Post new topic Reply to topic
Wed Jan 11, 2006 5:54 pm Reply and quote this post
I am currently learning how to code C(++).  I was hoping the CITF community could give me advice on the matter.  After recently discovering what I want to do in life, I founded out that I would need some sort of degree in Computer Sciences (the degree could be anywhere from a Bachelor to Masters).

With that said, C++ could take years to master, so I should start now to learn, atleast, the basics of the language before college.  I hope that you guys can give me links to tutorials, open-source IDEs, and just plain advice.

Contributed by PorkyCorky, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Wed Jan 11, 2006 7:37 pm Reply and quote this post
http://www.cprogramming.com/tutorial.html

Thats a good C++ tutorial I've used in the past. Do you have any other programming language experiance? If you don't, I would suggest that you learn Python first. It will make C++ a lot easier.

Contributed by Nitrous, iVirtua Ultimate Contributor
115 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Wed Jan 11, 2006 7:51 pm Reply and quote this post
i like

http://seangreasley.com/ they are video tutorials where you can watch how he does it.

oh and theres http://codeproject.com/ also


Last edited by krazykaveman on Wed Jan 11, 2006 7:52 pm; edited 1 time in total

Contributed by krazykaveman, iVirtua Ultimate Contributor
850 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Wed Jan 11, 2006 8:21 pm Reply and quote this post
I'm going to be learning C++ in about a year...  I'll also be working on java sometime around that time.  Yay.
Contributed by Greg M., iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Thu Jan 12, 2006 8:06 pm Reply and quote this post
I am making a very simple, but yet, experimental script.  It asks the user to input there IQ to find out if they are smarter or dumber than Steven Hawking.  But there is a problem, once the user enters their IQ, you can briefly see the assigned 'if' or 'else' statement before it exits.  After each line I have the code, cin.get(), so that the program would wait for the user to hit return/enter before it exits, but yet it exits within seconds.  Help?

Source code:
Code:

#include <iostream>
using namespace std;

int main(void)
{
    const int hawking = 200;
    int myIQ;
    
   cout << "Are you smarter than mathmatician Steven Hawking?  Enter your IQ to find out.";
   cin >> myIQ;
  
   if (myIQ > hawking)
      cout << "You are smarter than Steven Hawking!" <<cin.get();

   else
       if (myIQ = hawking)
       cout << "Your IQ is equal to Steven Hawking's IQ!" <<cin.get();
      
       else
       cout << "You are not as smart as Steven Hawking!" <<cin.get();
      
       return 0;
}


Please note that the <<cin.get()'s are on the same line, but the code table's word wrap brings it down a line.


Last edited by PorkyCorky on Thu Jan 12, 2006 8:08 pm; edited 1 time in total

Contributed by PorkyCorky, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Thu Jan 12, 2006 8:58 pm Reply and quote this post
I can make some sense of that program, since I know JAVA.
Contributed by Predator, Guest
510 iVirtua Loyalty Points • • • Back to Top

Thu Jan 12, 2006 9:35 pm Reply and quote this post
This is what I see (mind you I have never tried any programming):

Quote:
#include <iostream>
using namespace std;
***NO IDEA***
int main(void)
{
   const int hawking = 200;
   int myIQ;
***CONSTANT INITIALIZE HAWKING 200 (hawkings IQ is 200)
INITIALIZE MYIQ (my IQ is a variable)***

  
  cout << \"Are you smarter than mathmatician Steven Hawking?  Enter your IQ to find out.\";
  cin >> myIQ;
***BASICALLY JUST WHAT THE BOX SAYS
THEN AN INPUT BOX FOR YOUR IQ***


  if (myIQ > hawking)
     cout << \"You are smarter than Steven Hawking!\" <<cin.get();
***Variable myIQ is greater than 200 then it displays \"You are smarter than Steven Hawking!\" ***

  else
      if (myIQ = hawking)
      cout << \"Your IQ is equal to Steven Hawking's IQ!\" <<cin.get();
***If myIQ is not greater than 200, check if it is equal to 200.  If so, display \"Your IQ is equal to Steven Hawking's IQ!\" ***

      else
      cout << \"You are not as smart as Steven Hawking!\" <<cin.get();
***If not equal to 200, display \"You are not as smart as Steven Hawking!\"***
      return 0;
***something***
}


Obviously, reading is much easier than writing.

It seems to me that you are wasting CPU cycles (and code space) by setting the variable hawking.  You could just put in 200 rather than hawking, and not define it at the beginning.  I read a blog and this guy's pet peeve was temporary variables (like hawking).  Obviously this does not have an effect on performance in this issue, but it would be a bad habit to get into if you began writing more complicated code.


Last edited by Greg M. on Thu Jan 12, 2006 9:38 pm; edited 1 time in total

Contributed by Greg M., iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Thu Jan 12, 2006 11:25 pm Reply and quote this post
Greg, int = integer, not initialize. :P
Contributed by Myrdaal, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Fri Jan 13, 2006 6:42 am Reply and quote this post
But remember, I am a newb, so it is somewhat easier for me to use the hawking variable since that is how I learnt it in a tutorial.

Can you guys figure out why it exits once it 'outputs' the result?

Contributed by PorkyCorky, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Fri Jan 13, 2006 11:21 am Reply and quote this post
I'm not sure in that case since you have the <<cin.get() function.  However if you run it from an already open command line window the program will stay open.  So just open a command prompt window, cd the directory the program is in and run it.
Contributed by Myrdaal, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Sat Jan 14, 2006 1:13 am Reply and quote this post
Code:

#include <iostream>
using namespace std;

int main(void)
{
    const int hawking = 200;
    int myIQ;
    
   cout << "Are you smarter than mathmatician Steven Hawking?  Enter your IQ to find out.";
   cin >> myIQ;/n
  
   if (myIQ > hawking){
      cout << "You are smarter than Steven Hawking!" <<myIQ;/n
}

   else
       if (myIQ = hawking){
       cout << "Your IQ is equal to Steven Hawking's IQ!" <<myIQ;/n
}      

       else {
       cout << "You are not as smart as Steven Hawking!" <<myIQ;/n }
      
       return 0;
}


try this


Last edited by krazykaveman on Sun Jan 15, 2006 1:44 am; edited 1 time in total

Contributed by krazykaveman, iVirtua Ultimate Contributor
850 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Tue Jan 17, 2006 2:40 pm Reply and quote this post
yes this is a good site explore it a little and its realy easy

http://www.cprogramming.com/tutorial.html

Contributed by S.W.E, iVirtua Ultimate Contributor
130 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Wed Jan 18, 2006 5:20 pm Reply and quote this post
Quote:
yes this is a good site explore it a little and its realy easy

http://www.cprogramming.com/tutorial.html

Please, if you're not going to contribute don't bother to post. Someone already posted the exact same link, pay attention to the topic at hand.

Contributed by kahrn, iVirtua Ultimate Contributor
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Wed Jan 18, 2006 5:27 pm Reply and quote this post
oh ok well then ill contribute this link to porky to aid him in his gaining knowledge in C++


great site: http://www.cplusplus.com/doc/tutorial/

Contributed by S.W.E, iVirtua Ultimate Contributor
130 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Tue Jan 24, 2006 10:40 am Reply and quote this post
Fixed:
Code:

#include<cstdio>
#include<cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
  cout << "Are you smarter than mathmatician Steven Hawking? Enter your IQ to find out";
  cout << endl;

  int yours;
  cout << "Enter your IQ:";
  cin >> yours;

  if (yours > 200 )
  cout << "Congratulations! You have a higher IQ that Steven Hawking!";
  cout << endl;
  
  if (yours == 200)
  cout << "You have the same IQ has Steven Hawking";
  cout << endl;
  
  if (yours < 200 )
  cout << "You have a lower IQ than Steven Hawking";
  cout << endl;
  
  system("PAUSE");
  return 0;
  
}


Last edited by Woody. on Fri Jan 27, 2006 1:57 pm; edited 1 time in total

Contributed by Woody., iVirtua Regular Member
100 iVirtua Loyalty Points • View ProfileSend Private MessageBack to Top

Post new topic   Reply to topic


Page 1 of 2
Goto page 1, 2  Next

iVirtua Latest
Latest Discussion

Discuss...
Latest Articles and Reviews

Latest Downloads
Subscribe to the iVirtua Community RSS Feed
Use RSS and get automatically notified of new content and contributions on the iVirtua Community.


Tag Cloud
access amd announced applications author based beta building business card case company content cool core course cpu create data deal dec demo design desktop developers development digital download drive email feature features file files firefox flash free future gaming google graphics hardware help industry information intel internet iphone ipod jan launch linux lol love mac market media memory million mobile money movie music net nintendo nov nvidia oct office official online patch performance playing power price product program ps3 pst publish ram release released report rss sales screen search security sep server show size software sony source speed support technology thu tue update video vista war web website wii windows work working works xbox 360 2006 2007 2008

© 2006 - 2008 iVirtua Community (UK), Part of iVirtua Media Group, London (UK). Tel: 020 8144 7222

Terms of Service and Community RulesAdvertise or Affiliate with iVirtuaRSSPress Information and Media CoverageiVirtua Version 4PrivacyContact