VC++ and C++

How do you use the forum? Also Technical News.

Moderators: osRose dev team, ospRose dev team, osiRose dev team, Moderators

Forum rules
This forum is NOT a forum where you post a technical questions about osRose, osiRose or ospRose. Use the dedicated forum for that!

VC++ and C++

Postby marx09 on Tue Jan 06, 2009 3:10 pm

whats the difference? :)

which one is worth studying?
marx09
Jelly Bean
Jelly Bean
 
Posts: 29
Joined: Sun May 11, 2008 10:57 am

Re: VC++ and C++

Postby Rescudo on Tue Jan 06, 2009 3:58 pm

C++ is the programming language, VC++ is one of several available IDEs to develop C++ programs in (Code::Blocks and Dev-C++ are two other popular ones). You're comparing apples and oranges.
SEARCH - it's there for a reason!
User avatar
Rescudo
El Verloon Marshall
El Verloon Marshall
 
Posts: 872
Joined: Tue Mar 11, 2008 7:20 am

Re: VC++ and C++

Postby marx09 on Tue Jan 06, 2009 4:20 pm

oh, so C++ is the language and VC++ is a program that uses the c++ language?. Ok! i got the point! so since microsoft developed a vc++ program, does studying c++ will be a lot easier if i use vc++?
marx09
Jelly Bean
Jelly Bean
 
Posts: 29
Joined: Sun May 11, 2008 10:57 am

Re: VC++ and C++

Postby Souleater on Tue Jan 06, 2009 5:44 pm

No but at this point, Visual C++ is pretty much the one of the most user friendly IDEs out there (along with Borland C++ builder: i lurve their friggin RAD Tool *___*), the downside is, it's damn expensive if you want a decent suite :) But then again there is always the express editions :)
Image
Souleater
Antares
Antares
 
Posts: 355
Joined: Thu Aug 09, 2007 10:59 pm

Re: VC++ and C++

Postby marx09 on Thu Feb 05, 2009 3:37 pm

  1. //1st ever! :D
  2.  
  3.  
  4. #include<iostream.h>
  5. #include<conio.h>
  6. #include<stdlib.h>
  7.  
  8.  
  9. int main ()
  10. {
  11.     int a, b, c;
  12.     cout << "experience? \n 1 year? \n 2 years? \n 3 years? \n Answer: ";
  13.     cin >> a;
  14.     if( a > 3)
  15.     {
  16.         cout << "Please try again";
  17.         getch();
  18.         return 0;
  19.         }
  20.     system("cls");  
  21.     cout << "field? \n Electronics \n Computer \n Medicine \n Answer:";
  22.     cin >> b;
  23.    if( b > 3)
  24.     {
  25.         cout << "Please try again";
  26.         getch();
  27.         return 0;
  28.         }
  29.           system("cls");
  30.         cout << "degree? \n Bachelor in Science \n Information Technology \n Bachelor of Arts \n Answer:";
  31.         cin >> c;
  32.     if( c > 3)
  33.     {
  34.         cout << "Please try again";
  35.         getch();
  36.         return 0;
  37.         }
  38.         system("cls");
  39.  
  40.    if (b == 3 && c == 3)
  41.         {
  42.              cout << "Sorry, you do not meet the requirements";
  43.              getch();
  44.           system("cls");
  45.              }
  46.              else
  47.              {
  48.                   cout << "Congratulations! You're hired!";
  49.                getch();  
  50.         system("cls");
  51.         }
  52.  
  53.    getch();
  54.     return 0;
  55. }    


Hi again guys! here is my 1st c++ code ever! hahaha! Well finally after boring sessions in my programming class, he gave us this assignment. Well it works! Unfortunately through trial and error.

I'm wondering how should a programmer know which standard library to use and which (the int main() thing) to choose. Of course its about the function of the program but i'm quite confused like in making that assignment which one to use.

Hope someone will help me again! :D
marx09
Jelly Bean
Jelly Bean
 
Posts: 29
Joined: Sun May 11, 2008 10:57 am

Re: VC++ and C++

Postby Rescudo on Thu Feb 05, 2009 4:57 pm

After you have programmed for a bit, knowing what header to find your desired functions in becomes second nature :) You can look at the reference at www.cplusplus.com if you need to know what header to include for a specific function.
As for your int main () question, read here: http://www.visualcplusdotnet.com/visual ... net6h.html
Also, work on your indentation, it makes code much easier to read.
SEARCH - it's there for a reason!
User avatar
Rescudo
El Verloon Marshall
El Verloon Marshall
 
Posts: 872
Joined: Tue Mar 11, 2008 7:20 am

Re: VC++ and C++

Postby marx09 on Mon Mar 09, 2009 6:31 pm

Hi again guys! We're almost done with our C++ lesson,through some reading(since the professor is too lazy to teach us!) I've learned some basic parts of C++. Well this week, we'll be passing our project. We are assigned to make a program that will show the use of switches, if statements, loops, functions and array. Well frankly i can't think of a good program so I decided to make an IQ test one.
SO here it goes

  1. #include <iostream.h>
  2. #include <conio.h>
  3. #include <string>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. using std::string;
  7. using namespace std;
  8. int $gen = 0, $mat = 0, $gKn = 0, $sci = 0;
  9. int gen[9], mat[9], gKn[9], sci[9];
  10. char choice;
  11. string name;
  12.  
  13.    
  14.  
  15. main()
  16. {
  17.     int loopcount = 0;
  18.     cout << "Please Enter your First Name:";
  19.     cin >> name;
  20.     system("cls");
  21.     cout << "Welcome " << name <<" to the C++ Pre-IQ test!\nI prepared some"
  22.     << " questions that will test out your knowledge if your capable of doing"
  23.     << " IQ tests! \n\n"
  24.     << "Please select Category\n\n[1]General IQ\n\n[2]Mathematical Abilities"
  25.     << "\n\n[3]General Knowledge\n\n[4]General Science\n\nChoice: ";
  26.     cin >> choice;
  27.     while ($gen == 0 && $mat == 0 && $gKn == 0 && $sci == 0)
  28.     {
  29.     system("cls");
  30.     switch (choice)
  31.     {case '1':
  32.          cout << "General IQ\n"
  33.          << "Please read the question Properly\n\n"
  34.          << "1. What gets wetter and wetter the more it dries \n\n[1] Sand\n[2]"
  35.          << " Face \n[3] Towel \n\n";
  36.          cin >> gen[0];
  37.          if (gen[0] ==3)
  38.          {$gen++;}
  39.          cout << "\nYou answered " <<$gen <<" out of 10 questions!";
  40.          getch();
  41.          system("cls");            
  42.     case '2':
  43.          cout << "Mathematical Ability\nPlease read the question Properly\n\n"
  44.          << "1. Which number should come next in this series? \n\t"
  45.          << "25,24,22,19,15 \n[1]4\n[2]5\n[3]10\n\n";
  46.          cin >> mat[0];
  47.          if (mat[0] == 3)
  48.          {$mat++;}
  49.          cout << "\nYou answered " <<$mat <<" out of 10 questions";
  50.          getch();
  51.          system("cls");
  52.     case '3':
  53.          cout << "General Knowledge\n Please read each question Properly\n\n";
  54.          cout << "\n1. Europe is a Country. \n\n[1] Yes\n[2] No\n[3] It is becoming"
  55.          << " somewhat like it.\n\n";
  56.          cin >> gKn[0];
  57.          if (gKn[0] == 2)
  58.          {$gKn++;}
  59.          cout << "\nYou answered " <<$gKn <<" out of 10 questions";
  60.          getch();
  61.          system("cls");      
  62.     case '4':
  63.          cout << "Science Test\nPlease read the question Properly\n\n"
  64.          << "\n1. Where in the body are the smallest bones?\n\n[1] Ear\n"
  65.          << "[2] Ankle\n[3] Fingers\n\n";
  66.          cin >> sci[0];
  67.          if (sci[0] == 1)
  68.          {$sci++;}
  69.          cout << "\nYou answered " <<$sci <<" out of 10 questions";
  70.          getch();
  71.          system("cls");
  72.          
  73.     default:
  74.           if(choice >> 4)
  75.           {cout << "Please refer to Choices 1 - 4 only \nThe Program will restart";}
  76.            }
  77.    
  78.            cout << "\ntest loop for scores" << $gen <<$mat <<$gKn << $sci;
  79.            getch();}
  80.          
  81.     getch();
  82. }
  83.    
  84.  


Well I haven't typed the questions yet since i think it will be quite easy to do that with if statements.

So, my question is, in the default part of my switch, I want to return the program to the "choices" options again instead of closing up. Well im thinking of using a loop there(?) but I dont know how to return it there. :(

Again, thank you guys!

edit:
And I forgot to thanks Rescudo for helping me out with my last problem.
Yeah! cplusplus.com is a good site.

UPDATE
Here's the new code I made.
Last edited by marx09 on Tue Mar 10, 2009 4:16 pm, edited 1 time in total.
marx09
Jelly Bean
Jelly Bean
 
Posts: 29
Joined: Sun May 11, 2008 10:57 am

Re: VC++ and C++

Postby Maxxon on Tue Mar 10, 2009 10:10 am

you can put around your question thing an endless loop "for (;;)" and break out of it with "break;" if you are done with all questions.
Image
an anymous comment on a program called reloader:
what if a fatal error happens, will it restart it?
User avatar
Maxxon
Hawker's pet
Hawker's pet
 
Posts: 1305
Joined: Sat Nov 10, 2007 12:42 pm

Re: VC++ and C++

Postby marx09 on Tue Mar 10, 2009 4:12 pm

I keep getting errors with for loop so i put

while ($gen == 0 && $mat == 0 && $gKn == 0 && $sci == 0)

before the switch. I put that because what if the user chose case 4, He will end up finishing the quiz without answering the other categories. What I need is to end the loop IF all the 4 categories are answered.Thanks Maxxon! Hope you could help me with this!

Another thing, how can I sum up the contents of my array? thank you!
marx09
Jelly Bean
Jelly Bean
 
Posts: 29
Joined: Sun May 11, 2008 10:57 am


Return to Some Help / News

Who is online

Users browsing this forum: No registered users and 2 guests

cron