View Full Version : C++ Beginer
Swazi
02-11-2006, 10:42 PM
hi i started to learn c++ about a week ago before i started learning php because i my friend told me to learn c++ first but it got 2 hard so i went to php but everybody sayes to learn c++ first so i think ill do both
so my question is what exactly is a varieble used for? why use
chat hellowords="Hello!!!! IN C++";
printf("%s", hellowords);
when it could just be
printf("Hello!! IN C++");
??????
_Aerospace_Eng_
02-11-2006, 10:49 PM
So it can be dynamic. What if you wanted to change that variable later or what if you wanted to assign it a new variable. Using the printf statement you are able to format the variable how you want where as your second way you get the full string and nothing more. Setup a variable equal to a number like 5.52345 and then use the printf statement again like so
printf("%.2lf", YourVariable);
See how its formatted to two decimal places rather than printing out the full variable? lf might need to be f. I've never programmed in C++ before. I have programmed in C though.
Swazi
02-11-2006, 10:55 PM
that looks alot more harder than mine. i think ill just do
printf("1/3 = .33333333333333333333333333333333333333333"); than that other one
oracleguy
02-11-2006, 11:14 PM
Well in C++ you can also use cin and cout instead of scanf and printf and they are (much) easier to use.
Swazi
02-11-2006, 11:39 PM
one more question:
if i call a c++ program file.bmp and save it on a websight, can i have it run an pic on there computer but instead of it showing a pic it does something else?
Mhtml
02-12-2006, 08:40 AM
Well, yes an no. It is possible to have images and some other file formats execute as program files. However there can be no real need for this beyond wanting the malicious.
Swazi
02-12-2006, 04:38 PM
how??????
_Aerospace_Eng_
02-12-2006, 05:01 PM
Dude all of your questions well most of them have been about how to do something without the user knowing. How about you tell us exactly what it is you are trying to do? I see this thread getting locked soon just like your other one.
Swazi
02-12-2006, 06:00 PM
hey, buddy, if u dont have ne thing constructove to say, dont say it at all k?
Mhtml
02-12-2006, 06:14 PM
Aerospace is correct, I don't like where this thread is going. It is against our policy, well not just policy our ethics as well, to aid in development of malicious code.
I will request this thread closed.
hey, buddy, if u dont have ne thing constructove to say, dont say it at all k?I would hope you weren't refering to aerospace with that remark? Just the sort of thing that will get you on my naughty list.
missing-score
02-12-2006, 06:18 PM
hey, buddy, if u dont have ne thing constructove to say, dont say it at all k?
Actually, what he said was constructive. Trying to get an idea of what you need could be a vital part of offering you help. Besides, you should show some respect to people who are helping you out for free.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.