1
// a code to produce matrix style affect
#include "stdafx.h"
#include<iostream>
using namespace std;


int modulus(int Number, int number);

	char getchar(int lowerlimit, char a, int upperlimit);



int modulus(int Number, int number)



{

int q=Number/number;

return Number-(q*number);

}




char getchar(int lowerlimit, char a, int upperlimit)
{

return (a+modulus(lowerlimit,upperlimit));


}


int _tmain(int argc, _TCHAR* argv[])
{
	

char arr[80];


int j=7;
int k=2;
int l=5;
int m=1;

while(true)
{
int i=0;
while(i<40)
{
	if(arr[i]!=' ')
	{
arr[i]=getchar(j+i*i,33,30);

	}

  cout<<getchar(j+i*i,33,30);
cout<<getchar(7+3*3,33,30);    // just to check i added this statement and ran the 

program without including the statement just above it and figured out  modulus function doesn't seem to work for some reason even though it should, what it does is simply add 7+9+33 and prints out the character representing that value which is (,  even though what it should have done is that it should have applied modulus function to evaluate ((7+9)%30) and then should have added it to 33 as per stated in the function and then should have printed out the character represented by that value, atleast thats what i think.

i++;

}

j=(j+31);
k=(k+17);
l=(l+47);
m=(m+67);
arr[modulus(j,80)]=' ';  // this is supposed to start a new streak how?when it doesnt          evaluate to zero?

arr[modulus(k,80)]='';   // // this is supposed to end a streak how?
arr[modulus(l,80)]=' ';  // and this is supposed to start a new streak? how?
arr[modulus(m,80)]=''';  // // this is supposed to end a streak how? 
                  //how can they end or begin a streak when they are not even printed out in the code?
i=0
while(i<3000000)
{
	getchar(1,1,1);
	i++;
}

}
return 0;

}
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by histrungalot
0

Not sure what it is suppose to do, but what it does is for me after I got it to compile is repeat the same pattern every 1200 chars for infinity. The modulo function is correct.
((7+9)%30)+33 = 7+9+33 so it did what it should have.

cout << ::modulus(11,3) << endl;
cout << ::modulus(100,27) << endl;
cout << ::modulus(1,5) << endl;

Output

2
19
1

Also, you are testing values in arr before anything has been set of init-ed if(arr[i]!=' ') . How can you expect the output to be deterministic if arr has random values at the start of the loop?
What is a streak?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.