This program takes two matrices of order r1*c1 and r2*c2 respectively. Then, the program multiplies these two matrices (if possible) and displays it on the screen.
Category: C++
#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
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
Introduction to Arrays
An array is a data structure which allows a collective name to be given to a group of elements which all have the same type. An individual element of an array is identified by its own unique index or subscript. An array can be thought of as a collection of numbered boxes each containing one data item. Simple code for an… Continue reading Introduction to Arrays
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
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)
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
C++: #CoolCodez Part 2
Situation: Making a right angle triangle of numbers and alphabets. 1 A B 1 2 3 A B C D 1 2 3 4 5 #include<iostream.h> #include<conio.h> void main() { clrscr(); int counter, sym,… Continue reading C++: #CoolCodez Part 2
C++: #CoolCodez
Situation: Making patterns with numbers and alphabets. Pattern 1: 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 #include #include void main() { clrscr(); int sym, counter, row=5; for (counter=1; counter<=rows; countner++) { for (sym=1; symb<=counter; sym++) { cout<<"… Continue reading C++: #CoolCodez
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