Alright, i know this is partial "Noobish" but, bare with me. I for one think it's a great wonder, for making cool effects Yes i made it ;P
What it does, is use a for() loop with the end set to the total elements of the Array. It then couts the first element, which is a (A=0) A then gets incremented within the loop(by 1), until it reaches the end, which is the last string in the Array:
Code:
#include <cstdlib>
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;
#define PF 12 // Definites a constant
int slow_print();
int main()
{
slow_print();
cin.get();
cin.ignore();
return EXIT_SUCCESS;
}
//FUNCTION:::::::::::::::::::::::::::::::::::
int slow_print(){
int speed; // Pause speed between the couts
string words[PF] = { //Out array which holds our message
"H",
"E",
"L",
"L",
"O",
" ",
"W",
"O",
"R",
"L",
"D"};
int a = 0; //Will start from element 0 and increment until 0 > PF which is 12
cout << "How fast do you want the printing effect to appear?(Milliseconds): ";
cin >> speed; //OMG U NOT KJNOW THIS??
for (int l = 0; l < PF; l++){ //..Seriously
Sleep(speed);
cout << words[a]; // Couts the first element of the Array, which then increments to next element.
a++;
}
};
Leave the stupid remarks out, please.
Posts 1–15 of 37 · Page 1 of 3
Post a Reply
Tags for this Thread
None
Was this really necessary?
And why don't you use a string like this.
Code:
char str[PF] = "Hello World";
And why didn't you use
Code:
const int PF = 12;
instead of:
Code:
#define PF 12
Originally Posted by Cookie.
Was this really necessary?
And why don't you use a string like this.
Code:
char str[PF] = "Hello World";
And why didn't you use
Code:
const int PF = 12;
instead of:
Code:
#define PF 12
3 Words: Because I Can
Auto Writer??
Nice one.
Originally Posted by Horatio Caine
Auto Writer??
Nice one.
Not an auto writer >_< Just makes that Movie like print effect, where words are printed one at the time..Like an AI software...
Originally Posted by VirtualDUDE
Not an auto writer >_< Just makes that Movie like print effect, where words are printed one at the time..Like an AI software...
that's what I meant.
Originally Posted by Horatio Caine
that's what I meant.
So did i..
Auto Writer?? cool
Originally Posted by Cookie.
Was this really necessary?
And why don't you use a string like this.
Code:
char str[PF] = "Hello World";
And why didn't you use
Code:
const int PF = 12;
instead of:
Code:
#define PF 12
#1: Because then cout would print the whole string at once.
#2: Why should he? defines are fine :3
Much better than a series of string objects. This solution is elegant, concise, and uses modern C++.
Code:
#define PF 12 // Definites a constant
really now?
Comments are for explaining WHY something happens, not just explaining the line in english
Code:
int speed; // Pause speed between the couts
string words[PF] = { //Out array which holds our message
cout << words[a]; // Couts the first element of the Array, which then increments to next element.
a++;
^ Never would have guessed what these do, thanks
why the
Code:
int slow_print()
when i see no int being returned
Originally Posted by Hell_Demon
#1: Because then cout would print the whole string at once.
#2: Why should he? defines are fine :3
He is calling the Sleep() function which will make it to write the words for him
Much better than a series of string objects. This solution is elegant, concise, and uses modern C++.
Ok...Not gonna use it, but ok.
Originally Posted by Virtual Void
Comments are for explaining WHY something happens, not just explaining the line in english
Code:
int speed; // Pause speed between the couts
string words[PF] = { //Out array which holds our message
cout << words[a]; // Couts the first element of the Array, which then increments to next element.
a++;
^ Never would have guessed what these do, thanks
why the
Code:
int slow_print()
when i see no int being returned
Unless people are completely retarded, they can see how it all works. It's written in human readability not in machine code. Besides, i comment what the functions/etc are for, so people know it, and can figure out the rest.
The slow_print function was something i made it to, to let me add more features, in the future
Please keep in mind, this is kind of my second time using Arrays. Thus it being a long time ago, i learned about them. I've never actually had a use of them, before now