Message Board Basketball Forum - InsideHoops

Go Back   Message Board Basketball Forum - InsideHoops > InsideHoops Main Basketball Forums > Off the Court Lounge

Off the Court Lounge Basketball fans talk about everything EXCEPT basketball here

Reply
 
Thread Tools
Old 02-18-2014, 10:53 PM   #16
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Code:
// cap2 2.19.cpp : Defines the entry point for the console application. //Este programa calcula la suma, resta, multiplicacion, promedio, el mas pequeno y el mas grande de tres numeros #include "stdafx.h" #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int n1, n2, n3, sum, sub, mult, ave, smallest, largest;//Inicializar variables cout<<"Input three integers "; cin>>n1>>n2>>n3;//Numeros que el usuario anade sum = n1+n2+n3;//suma de los numeros sub = n1+n2+n3;//resta de los numeros mult = n1*n2*n3;//multiplicacion de los numeros ave = sum/3;// este es los calculos del promedio if (n1>n2)//Este if statement me calcula cual es el mas grande de los numeros { if(n1>n3) largest = n1; else if (n2>n3) largest = n2; else largest = n3; } else { if (n2>n3) largest = n2; else largest = n3; } if (n1<n2)//este if statement me calcula el mas pequeno { if(n1<=n3) smallest = n1; else if (n2<=n3) smallest = n2; else smallest = n3; } else { if (n2<n3) smallest = n2; else smallest = n3; } system("cls"); cout<<"Input three integers "<<n1<<" "<<n2<<" "<<n3<<endl; cout<<"Sum is "<<sum<<endl<<"Average is "<<ave<<endl<<"Product is "<<mult<<endl<<"Smallest is "<<smallest<<endl<<"Largest is "<<largest<<endl; system("pause"); return 0; }

Got it, it now works.
Bandito is offline   Reply With Quote
Old 02-18-2014, 10:54 PM   #17
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by shaq2000
Also, your average variable should be a float or double and make sure to avoid integer division:

Code:
double ave; ave = sum / 3.0;
I want it to be an integer

I don't want decimals on that shiet.
Bandito is offline   Reply With Quote
Old 02-18-2014, 10:55 PM   #18
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by Draz
Came to say hello
sup



Bandito is offline   Reply With Quote
Old 02-18-2014, 11:01 PM   #19
shaq2000
mde
 
shaq2000's Avatar
 
Join Date: Jul 2012
Location: Encino, CA
Posts: 738
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by Bandito
I want it to be an integer

I don't want decimals on that shiet.

Well, then you won't always be getting the average.
shaq2000 is offline   Reply With Quote
Old 02-18-2014, 11:04 PM   #20
ace23
*****
 
ace23's Avatar
 
Join Date: May 2011
Location: Houston, TX
Posts: 9,487
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by Bandito
I want it to be an integer

I don't want decimals on that shiet.
Do you not want to round up in any case?
ace23 is offline   Reply With Quote
Old 02-18-2014, 11:08 PM   #21
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by shaq2000
Well, then you won't always be getting the average.
True, but I am going by the book for now. It will probably start to talk about float, double, char etc...in the next chapter... I am going by the book so I can understand the basics first.
Bandito is offline   Reply With Quote
Old 02-18-2014, 11:09 PM   #22
Bosnian Sajo
Why?
 
Bosnian Sajo's Avatar
 
Join Date: Feb 2010
Location: The ISH Grim Reaper
Posts: 10,441
Default Re: if you don't have visual studio 2010 don't even come here

Kobe > Lebron
Bosnian Sajo is offline   Reply With Quote
Old 02-18-2014, 11:10 PM   #23
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by ace23
Do you not want to round up in any case?
nope
Bandito is offline   Reply With Quote
Old 02-18-2014, 11:10 PM   #24
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by Bosnian Sajo
Kobe > Lebron
I am going to make an app like that and call it ISH app or something just for the lulz....
Bandito is offline   Reply With Quote
Old 02-18-2014, 11:16 PM   #25
cuad
kings fan
 
Join Date: Sep 2011
Posts: 1,359
Default Re: if you don't have visual studio 2010 don't even come here

Writing a line like this
Quote:
int largest;
is called "declaring an int". This is not the same as "initializing an int". Initializing an int looks like
Quote:
int largest; // declare
largest = 0; // initialize

or

int largest = 0; // declare and initialize on the same line.
Some languages/compilers will automatically initialize ints to 0, but I guess C++ or your compiler doesn't.
cuad is offline   Reply With Quote
Old 02-18-2014, 11:20 PM   #26
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by cuad
Writing a line like this is called "declaring an int". This is not the same as "initializing an int". Initializing an int looks like Some languages/compilers will automatically initialize ints to 0, but I guess C++ or your compiler doesn't.
Oh in C++ when they mean by initialize they mean that the variable doesn't have an value assigned to it after it was declared. At least that's how I took it when I saw the error in the compiler.

But yes you are right.
Bandito is offline   Reply With Quote
Old 02-18-2014, 11:23 PM   #27
MadeFromDust
exercise profits littl
 
MadeFromDust's Avatar
 
Join Date: Jun 2006
Location: I come from a dusty place.
Posts: 2,617
Default Re: if you don't have visual studio 2010 don't even come here

Make it pop-up a window and output to that instead of using "console" and ill-advised "system" calls
MadeFromDust is offline   Reply With Quote
Old 02-19-2014, 12:09 AM   #28
nathanjizzle
#Trump4Treason
 
nathanjizzle's Avatar
 
Join Date: Apr 2011
Posts: 15,134
Default Re: if you don't have visual studio 2010 don't even come here

Any one know where I can start learning python
nathanjizzle is offline   Reply With Quote
Old 02-19-2014, 06:25 AM   #29
Bandito
NBA Legend
 
Bandito's Avatar
 
Join Date: Jul 2009
Posts: 16,663
Default Re: if you don't have visual studio 2010 don't even come here

Quote:
Originally Posted by nathanjizzle
Any one know where I can start learning python
If you already know how to program just check out any good phyton website. I bought a book called phyton : programming from oreilly which i am using to learn phyton.
Bandito is offline   Reply With Quote
Old 02-19-2014, 07:15 AM   #30
embersyc
Lurker
 
embersyc's Avatar
 
Join Date: Jun 2006
Location: Detroit
Posts: 4,534
Default Re: if you don't have visual studio 2010 don't even come here

Unless you specifically need the windows forms, check out Qt.

http://qt-project.org/

It's free and open source and really optimized for mobile development.

Who knew there were so many programmers on ISH?

embersyc is offline   Reply With Quote
This NBA Basketball News Website Sponsored by:


Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 06:23 PM.






NBA BASKETBALL FORUM KEY LINKS:

NBA Basketball

NBA Rumors

Basketball Blog

NBA Videos

Search Site

FOLLOW US
Twitter
Facebook
Instagram
YouTube
















Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd. Terms of Use/Service | Privacy Policy