/cppBootcamp

2nd part of the cpp bootcamp by yacc

Primary LanguageC++

YACC bootcamp session 2

Loops

while

for

Questions

  1. Print first n natural numbers
  2. Print first n odd/even numbers
  3. Calculate n!
  4. Calculate the nth fibonacci number
  5. The idea of t testcases for a cp problem
  6. Take input till sum exceeds 100, then return how many inputs have been taken

Arrays

  1. Find min, max and average of n input numbers
  2. Find all fibonacci numbers upto n
  3. For n inputs between 1 and 30, find frequency of each number

Functions

Re-implement the previous questions using functions

  1. Find the second and third maximum element in an array of positive integers

Recursion

  1. Calculate n! using recursion
  2. Calculate the nth fibonacci number using recursion

Strings

  1. Draw an n sided pyramid using '*'s
  2. Write a program that reverses an input string

Pointers

Only overview, and 1 pass by reference function

GCC

C/C++ code is compiled using GCC in Linux(GNU) and MinGW in Windows
gcc is used to compile C and g++ to compile C++
Basic gcc commands

$ g++ [name of file] -o [name of output file]

note: -o [output name of file] is not neccessary. By default it compiles to a file named a.out.

To run the compiled file, simply do

$ ./a.out

or, for file name,

$ ./[name of output file]