Simple C++ Variables

Posts 1–15 of 32 · Page 1 of 3
Simple C++ Variables
This simple program reads whatever number you type in and sends it back to you. Pretty simple, I made it from memory. Feel free to pick through it.

And a virus scan for everyone who thinks I packed this thing with a keylogger. http://www.virustotal.com/analisis/8...0a8-1257735199
VariableTest.rarattachment deleted · 8 downloads before removal
Prety nice dude is a prety smart program
u can extend this and for example
Code:
\\ do u want to try again.

int x ;
switch(x)
{
case 1:
main();
break;
case 2;
break;
}
Yeh this is neat I guess, but why is the file size so large? since its such a small program. 465 Kb is actually quite large for it. :L
Quote Originally Posted by why06 View Post
Yeh this is neat I guess, but why is the file size so large? since its such a small program. 465 Kb is actually quite large for it. :L
Because its actually a key logger =O
Quote Originally Posted by zhaoyun333 View Post
Because its actually a key logger =O
I don't think so...

Anyway. ilovecookies, the basic stuff you need to know is farther on in that book. The more you learn the more you can do with it. I really didn't even try to make anything till I was about 5 chapters, partly because I've covered this kind of stuff before, but also because you need to know more about strings and other variables, loops etc. Before you can really even make some basic programs. The first chapter is just usually a quick start chapter that show you how to write Hello World the next chapters will explain more.
Quote Originally Posted by why06 View Post
I don't think so...

Anyway. ilovecookies, the basic stuff you need to know is farther on in that book. The more you learn the more you can do with it. I really didn't even try to make anything till I was about 5 chapters, partly because I've covered this kind of stuff before, but also because you need to know more about strings and other variables, loops etc. Before you can really even make some basic programs. The first chapter is just usually a quick start chapter that show you how to write Hello World the next chapters will explain more.

Thanks for the reply man, and yeah, i've been reading it but the projects listed seem pointless. I understand the basic structure and such, but as you said I need to learn more about strings, variables, I know a few loops, but no uses for them (Other than like calculators, but that is basic unless you try to make like graphing functions or whatever)

But I guess I could wait till later in the book, I just wanted to get some basic knowledge going so when it comes to the harder stuff I'm not looking at simple parts of the program like "wtf". Such as.

I understand everything in your program TheElement12, exce[t cin.ignore();, I understand cin.get(); instructs the program to wait on the enter key, but does cin.ignore(); do just the opposite? Does it ignore input from the enter key? If you enter a number without the cin.ignore(); command will the window just close?
I don't know why the file is so big. I think it is the compiler. I use Dev C++.
Alright, i'm a super noob, but I have no clue how you guys read the source code. Did you release it to a few people? And is this somehow a long intricate code? Because I was reading a C++ beginner primer and they did basically the same thing, but with only a few lines of coding. Can't think of it off top.

Personally I was just wanting to get a glance at the code because i'm wanting to learning C++ myself, and am only on the second chapter of C++ Primer 5th edition, and I'm wanting to work with what I know so far, but I just can't think of anything to try to make a program for. Like I want to hack, but there's no way in hell I could do that with what I know. And I don't want to progress further in the book until I understand the first couple of basic things.
Quote Originally Posted by ilovecookies View Post
Alright, i'm a super noob, but I have no clue how you guys read the source code. Did you release it to a few people? And is this somehow a long intricate code? Because I was reading a C++ beginner primer and they did basically the same thing, but with only a few lines of coding. Can't think of it off top.

Personally I was just wanting to get a glance at the code because i'm wanting to learning C++ myself, and am only on the second chapter of C++ Primer 5th edition, and I'm wanting to work with what I know so far, but I just can't think of anything to try to make a program for. Like I want to hack, but there's no way in hell I could do that with what I know. And I don't want to progress further in the book until I understand the first couple of basic things.
The source code is:

#include <iostream>

using namespace std;

int main()
{
int thisisanumber;

cout<<"Insert a number here, then press enter: ";
cin>> thisisanumber;
cin.ignore();
cout<<"The number you entered was: "<< thisisanumber <<"\n";
cin.get();
}

Very simple, code used for beginners like me.


ALSO: This is not a keylogger or a virus of any kind, so zhaoyun333, shut the fuck up, where is your proof it is a virus?
Uhmm screeny and virus scan? Anyway GJ i guess
Ok, uploaded a virus scan since it's a "virus".
ilovecookies, cin.ignore() keeps the window open AFTER I press enter, so if cin.ignore() wasn't there, after I pressed enter, the window would automatically close.
Quote Originally Posted by theelement12 View Post
ilovecookies, cin.ignore() keeps the window open AFTER I press enter, so if cin.ignore() wasn't there, after I pressed enter, the window would automatically close.
Ooooh, ok ok so instead of needing enter to close the window, it needs cin.ignore(); to stop the enter key from closing the window after inputting the number. Alright thanks man!
Posts 1–15 of 32 · Page 1 of 3
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?