Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

need to learn some basic C++ fast


  • Please log in to reply
7 replies to this topic
A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

In a national - level competition I am supposed to compete in C++ .

 

I know little bit o' JAVA but unluckily there is no scope for that in the event.  

 

I will have to learn the basic syntax, creating user-defined functions, creating arrays and all other things need to work with maths as the competition asks logical / mathematical questions much like Project Euler ones. 

 

Can anyone recommend a small tutorial particularly covering my interested area ? and more importantly what are the software installations needed ? IDE ? Compiler ?  :/  :/

 

 

 

 


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Hi 
I know 2 C++ compilers.

  • One is Microsoft Visual C++ 
  • the other one is the GCC compiler.

Microsoft Visual C++ comes in different Version with a complex IDE.
Dunno about the GCC C++ compiler.
 
Basic Syntax:
Ill simply tell you the greatest difference between AHK syntax and C++ syntax.
First:
AHK:

a:=20
if (a=20)
   msgbox

C++:

#include <iostream>
using namespace std;

int main ()
{
int a=20;
if (a==20)
    cout << "a is 20"; 
}
  • Variables need to have a specific preset type, you define that type before you start using the var.
  • You assign expressions in AHK with := in C++ with = only !
  • You compare in AHK with = or == in C++ only with == !
  • You have to write these ****ing semicolons after every line (except it is an control statement like the if here) !
  • C++ is case sensitive !.
  • Includes are similar to AHK.
  • Ifs have some similarities with AHK ifs.
  • Functions also have a specific return type.
  • Evey pieces of executed code are inside functions (this time the main function)

AHK:

function(a,b,c)
{
return a*b*c
}

C++:

int function(int a,int b,int c)
{
return a*b*c;
}

Still the type problem.

 

Now Pointers&Arrays:

a:=[]
Loop,15
  a.insert(A_Index)
;or
a:=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

C++

int a[15] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};

accessing:

AHK&C++:

a[x] ;

You can find more information here:

http://www.cplusplus...gram_structure/


Visit the new forum ahkscript.org.

http://ahkscript.org


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

Hi 
I know 2 C++ compilers.

  • One is Microsoft Visual C++ 
  • the other one is the GCC compiler.

Microsoft Visual C++ comes in different Version with a complex IDE.
Dunno about the GCC C++ compiler.

What about Code::Blocks and Dev C++ ? 

Thanks for your time spent on typing those info, very helpful . I had a downloaded copy of cplusplus.com 's tutorial and so I will use that for further study.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Compared to GCC ánd VC++ they are rather small.


Visit the new forum ahkscript.org.

http://ahkscript.org


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

yes, small and so I downloaded one of them (dev) in the meanwhile. 

Will try them later.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

I stressed on dev c++ and code::blocks because the competition is supposed to use them

 

@nnnik

Cool .  Ran my first code , yours code. 


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan


vasili111
  • Members
  • 40 posts
  • Last active: Feb 14 2016 07:25 AM
  • Joined: 08 Apr 2013

You can also check qt 5. It has very nice IDE.



A v i
  • Members
  • 1323 posts
  • Last active: Nov 14 2015 06:56 PM
  • Joined: 30 Jan 2013

@vasili111 Thanks... don't know about the IDE but it has a nice site.

 

@All

How to extract number from string and vice versa in C++ ?

static_cast<type> doesn't work.


Now a CS Undergrad. | My WebsiteAutohotkey Scripts | Softwares

Telegram me : @aviaryan