This is a sample video. To access the full content, please Login
I am currently learning C++ through the Spoken Tutorial series, and I came across a confusing behavior in the for loop example from the tutorial.In my practice, I am also using Pass4Future CPP Practice Questions to improve my understanding of the concepts. While working on one of these questions, I noticed that my for loop behaves differently than what was shown in the tutorial video.Here is a simplified version of my code:#include <iostream>using namespace std;int main() { for (int i = 0; i < 5; i++) { cout << i << " "; } return 0;}What I expected: 0 1 2 3 4 but results are differentsI tried to compare it with the tutorial example, but I am still confused about why the behavior is different.Could someone please help me understand why this is happening? Is this difference related to compiler settings, or my code?
Explain about for loop??
#include <stdio.h>int main(){ int rowCount, columnCount, i, j; int firstMatrix[10][10], secondMatrix[10][10], resultMatrix[10][10]; printf("Number of rows of matrices to be subtracted : "); scanf("%d", &rowCount); printf("Number of columns matrices to be subtracted : "); scanf("%d", &columnCount); printf("Elements of first matrix : \n"); for (i = 0; i < rowCount; i++) for (j = 0; j < columnCount; j++) scanf("%d", &firstMatrix[i][j]); printf("Elements of second matrix : \n"); for (i = 0; i < rowCount; i++) for (j = 0; j < columnCount; j++) scanf("%d", &secondMatrix[i][j]); printf("Difference of entered matrices : \n"); for (i = 0; i < rowCount; i++) { for (j = 0; j < columnCount; j++) { resultMatrix[i][j] = firstMatrix[i][j] - secondMatrix[i][j]; printf("%d\t",resultMatrix[i][j]); } printf("\n"); } return 0;}ByN.L.PoojaEce departmentIRTT
1033 visits
Outline:ଲୁପ୍ସ -ଲୁପ୍ସ -ହ୍ୱାଇଲ୍ ଓ ଡୁ-ହ୍ୱାଇଲ୍ ଲୁପ୍ସ ପାଇଁ ସିଣ୍ଟାକ୍ସ -ହ୍ୱାଇଲ୍ ଓ ଡୁ-ହ୍ୱାଇଲ୍ ଲୁପ୍ସର ତୁଳନା - ଫର୍ ଲୁପ୍ସ ପାଇଁ ସିଣ୍ଟାକ୍ସ -ଏରର୍ସ
ଲୁପ୍ସ -ଲୁପ୍ସ -ହ୍ୱାଇଲ୍ ଓ ଡୁ-ହ୍ୱାଇଲ୍ ଲୁପ୍ସ ପାଇଁ ସିଣ୍ଟାକ୍ସ -ହ୍ୱାଇଲ୍ ଓ ଡୁ-ହ୍ୱାଇଲ୍ ଲୁପ୍ସର ତୁଳନା - ଫର୍ ଲୁପ୍ସ ପାଇଁ ସିଣ୍ଟାକ୍ସ -ଏରର୍ସ
Show video info
Pre-requisite