#CoolCodez

Situation: User inputs a string and code tells you the number of lower case and upper case alphabets, numbers, spaces, and special characters. #include<iostream.h> #include<conio.h> #include<stdio.h> class Array { private: char string[30]; int len, vowel, conso, upper, lower, space, special, dig; public: Array() { len=vowel=conso-lower=upper=dig=space=special=0; } void process() { cout<<"\n\t Enter string: "; gets(string); } void… Continue reading #CoolCodez

Posted in C++

C++: #CoolCodez Part 3

SITUATION: MAKING A RIGHT ANGLE TRIANGLE OF NUMBERS AND ALPHABETS. https://youtu.be/hiVlxc3tVPA #include #include void main() { clrscr(); int row, temp=0, space, num=1, tempnum=1, cois; char alpha='A', tempalpha='B'; cout<<"\n\n"; for(row=5;row>0;row--) { if(row%2==0) { tempnum--; num=tempnum; } else { tempalpha--; alpha=tempalpha; } cout<<"\t"; for(space=temp;space>0;space--) { cout<<"\t"; } temp++; for(cois=row;cois>0;cois--) { if(row%2==0) { cout<<"\t"<<alpha++; } else { cout<<"\t"<<num++; }… Continue reading C++: #CoolCodez Part 3

Posted in C++

Java: Learning the Basics

Situation: Find the greater number between two numbers. import java.util.*; public class Greaternumber { private int num1, num2; Scanner scr = new Scanner(System.in); { System.out.print("\n\t Enter first number: "); num1=scr.nextInt(); System.out.print("\n\t Enter first number: "); num2=scr.nextInt(); } public void check() { if(num1>num2) { System.out.print("\n\t Greater number is " + num1); } else { System.out.print("\n\t Greater… Continue reading Java: Learning the Basics

Posted in C++

Introduction to Object Orientated Programming (OOP)

What is OOP? Object Orientated Programming attempts to demystify and organize programming in a structured manner so that other programmers can work on it as well. It essentially works on objects rather than "actions" and data rather than logic. The language was formed by analyzing the very nature of the real world. The following principles are the… Continue reading Introduction to Object Orientated Programming (OOP)

Posted in C++

C++: Learning the Basics – Right Alignment

Situation 1: Pattern shown below but the text is aligned to the right. #include<iostream.h> #include<conio.h> void main() { clrscr(); int sym, rows, space=5; char alpha; for (rows=5, row=1; rows>=1; rows--, row++) { alpha='A'; for(space=0; space<rows-1; space++) { cout<<"\t"; } for (sym=1; sym<=rows; sym++) { if(rows%2==0) { cout<<"\t"<<sym; } else { cout<<"\t"<<alpha; alpha++; } } cout<<"\n";… Continue reading C++: Learning the Basics – Right Alignment

Posted in C++

C++: Learning the Basics – Making Patterns

Situation: Make the following patterns - 1. Patterns with asterisks #annotated #include <iostream.h> #include <conio.h> void main() { clrscr(); int rows=5, counter, sym; #you can ask the user for number of rows, but I have just stated that rows=5 for simplicity for (counter=1; counter<=rows; counter++) { for (sym=1; sym<=counter; sym++) #sym stands for symbol. sym… Continue reading C++: Learning the Basics – Making Patterns

Posted in C++