|
Random Thoughts.....What are you thinking?
Server: Bahamut
Game: FFXI
Posts: 1742
By Bahamut.Savannahlynn 2012-02-21 18:30:37
Valefor.Slipispsycho said: »Okay so I just woke up and wife told me son got sent to the office today. Apparently, while in PE, he just walked up to some girl and kissed her right on the lips.. (He's 7.)
omg...lol I could see Max doing that if I hadn't already had the no kissing anyone talk....
His "girlfriend" kissed him on the cheek in preschool...lol
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 18:33:48
chaos if you're around, i think i sufficiently hate void functions now I knew the time would come... :P
i have an exercise i have to do and i have to convert an older program from a few chapters back and put the calculations in void functions.
but the second calculation uses the result of the first, so what i did was pass by reference, but im getting an error that i have no idea what it means when i try to compile. Code //Purpose: to calculate fat calories and fat percentage
//Author:
//Date: 2/21/2012
//Filename: intermediate17.cpp
//Input: totalCals, fatGrams
//Output: fatCals, fatPercent
#include <iostream>
#include <iomanip>
using namespace std;
//function prototypes
void getFatCals(int grams, int &fCals);
void getFatPercent(double fCals, double tCals, double &fPercent);
int main()
{
//declare variables
int totalCals = 0;
int fatGrams = 0;
int fatCals = 0;
double fatPercent = 0;
//enter input items
cout << "Total Calories: ";
cin >> totalCals;
cout << "Grams of fat: ";
cin >> fatGrams;
//determine whether the data is valid
if(totalCals >= 0 && fatGrams >= 0)
{
//calculate and display the output
getFatCals(fatGrams, fatCals);
getFatPercent(fatCals, totalCals, fatPercent);
cout << "Fat calories: " << fatCals << endl;
cout << fixed << setprecision(0);
cout << "Fat percentage: " << fatPercent << "%" << endl;
}
else
{
cout << "Input error" << endl;
} //endif
return 0;
}//end of main function
//***Funtion Definitions***
void getFatcals(int grams, int &fCals)
{
//calculate the fat calories
fCals = grams * 9;
}//end getFatCals function
void getFatPercent(double fCals, double tCals, double &fPercent)
{
//calculate the fat percent
fPercent = fCals / tCals * 100;
}//end getFatPercent function
the error i get is error LNK2001: unresolved external symbol "void __cdecl getFatCals(int,int &)" (?getFatCals@@YAXHAAH@Z) c:\Users\-\documents\visual studio 2010\Projects\TryThis17solution\TryThis17\Intermediate17.obj
Bismarck.Magnuss
Server: Bismarck
Game: FFXI
Posts: 28615
By Bismarck.Magnuss 2012-02-21 18:37:36
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 18:42:45
chaos if you're around, i think i sufficiently hate void functions now I knew the time would come... :P
i have an exercise i have to do and i have to convert an older program from a few chapters back and put the calculations in void functions.
but the second calculation uses the result of the first, so what i did was pass by reference, but im getting an error that i have no idea what it means when i try to compile. Code //Purpose: to calculate fat calories and fat percentage
//Author:
//Date: 2/21/2012
//Filename: intermediate17.cpp
//Input: totalCals, fatGrams
//Output: fatCals, fatPercent
#include <iostream>
#include <iomanip>
using namespace std;
//function prototypes
void getFatCals(int grams, int &fCals);
void getFatPercent(double fCals, double tCals, double &fPercent);
int main()
{
//declare variables
int totalCals = 0;
int fatGrams = 0;
int fatCals = 0;
double fatPercent = 0;
//enter input items
cout << "Total Calories: ";
cin >> totalCals;
cout << "Grams of fat: ";
cin >> fatGrams;
//determine whether the data is valid
if(totalCals >= 0 && fatGrams >= 0)
{
//calculate and display the output
getFatCals(fatGrams, fatCals);
getFatPercent(fatCals, totalCals, fatPercent);
cout << "Fat calories: " << fatCals << endl;
cout << fixed << setprecision(0);
cout << "Fat percentage: " << fatPercent << "%" << endl;
}
else
{
cout << "Input error" << endl;
} //endif
return 0;
}//end of main function
//***Funtion Definitions***
void getFatcals(int grams, int &fCals)
{
//calculate the fat calories
fCals = grams * 9;
}//end getFatCals function
void getFatPercent(double fCals, double tCals, double &fPercent)
{
//calculate the fat percent
fPercent = fCals / tCals * 100;
}//end getFatPercent function
the error i get is error LNK2001: unresolved external symbol "void __cdecl getFatCals(int,int &)" (?getFatCals@@YAXHAAH@Z) c:\Users\-\documents\visual studio 2010\Projects\TryThis17solution\TryThis17\Intermediate17.obj Look back many many pages ago when I said void isn't good to use.
Because you can't dereference a void pointer.
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 18:45:08
Just change the voids to whatever type they're calculating and adjust accordingly. Sorry I can't be too specific, I've been doing php all day and I'm beat from programming atm, lol.
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 18:45:38
the thing is, i have to use void functions, because this chapter is on void functions and pointers
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 18:49:23
Are you allowed to make your main vars pointers then?
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 18:52:03
Are you allowed to make your main vars pointers then?
huh?
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 18:52:28
Unless you they want you to do it this way:
void getFatCals(int grams, int *fCals);
then when you call it do:
getFatCals(fatGrams, &fatCals);
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 18:57:25
Are you allowed to make your main vars pointers then?
huh? I think they way I just put is what they're looking for.
Fenrir.Scragg
Administrator
Server: Fenrir
Game: FFXI
Posts: 2579
By Fenrir.Scragg 2012-02-21 18:57:36
Line 51, getFatCals
Make sure the C is uppercase to match the prototype.
[+]
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 18:58:51
we havent learned anything about dereferencing, just passing by reference
edit: derp, thanks scragg
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 19:01:22
Line 51, getFatCals
Make sure the C is uppercase to match the prototype. lol
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 19:03:36
Reminds me of the case of the extra } today.
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 19:04:34
intellisense has failed me today =/
Odin.Liela
Server: Odin
Game: FFXI
Posts: 10191
By Odin.Liela 2012-02-21 19:33:56
Random!
VIP
Server: Siren
Game: FFXI
Posts: 14552
By Siren.Kalilla 2012-02-21 19:50:41
<.>
Bismarck.Dreadnot
Server: Bismarck
Game: FFXI
Posts: 5113
By Bismarck.Dreadnot 2012-02-21 19:51:40
Liela! You are Terra in my FF6 game. it was decided earlier today.
[+]
VIP
Server: Siren
Game: FFXI
Posts: 14552
By Siren.Kalilla 2012-02-21 19:53:11
I'm just weird, I never change the character names from their default name :x
I'm not good at making names lol >.>;
Cerberus.Irohuro
Server: Cerberus
Game: FFXI
Posts: 6583
By Cerberus.Irohuro 2012-02-21 19:57:46
i never do either, because, i mean, thats their names (except i change some of the names in 5, theyre terrible. and in dual hearts, what kind of names are rumble and tumble?)
Leviathan.Chaosx
Server: Leviathan
Game: FFXI
Posts: 20284
By Leviathan.Chaosx 2012-02-21 20:00:10
You no like Butz?
Odin.Liela
Server: Odin
Game: FFXI
Posts: 10191
By Odin.Liela 2012-02-21 20:08:55
Bismarck.Dreadnot said: »Liela! You are Terra in my FF6 game. it was decided earlier today.
:o /flattered
Kujata.Daus
Server: Kujata
Game: FFXI
Posts: 3451
By Kujata.Daus 2012-02-21 20:43:17
Finished reading the Hunger Games trilogy.
I really like the plot and the idea of it but I still have lots of complaints about it (mostly the 3rd book), so I was kind of really disappointed..especially considering how much people have been raving about it. However, Im not sorry that I read it and I finally watched a bunch of movie trailers and looked up the cast list on imdb. I'm hoping the movies are much better than the books. So I'm really excited for it to be coming out.
[+]
Caitsith.Zahrah
Server: Caitsith
Game: FFXI
By Caitsith.Zahrah 2012-02-21 21:12:18
REALLY REALLY RANDOM:
You know, I forgot how much I liked Amano's work. Like I said earlier, never really delved into anything but XI for the most part. I remember the HS BF showing me all of this ages ago. I wonder why I haven't really thought of Amano in a while.

^^^I wish female WHM actually looked like this.^^^
EDIT: Oh crap! Did I break RT by talking about art?
Server: Shiva
Game: FFXI
Posts: 27982
By Shiva.Spathaian 2012-02-21 21:35:51
[+]
Caitsith.Zahrah
Server: Caitsith
Game: FFXI
By Caitsith.Zahrah 2012-02-21 21:36:42
NVM. I didn't!
/wipes sweat from forehead
Server: Shiva
Game: FFXI
Posts: 27982
By Shiva.Spathaian 2012-02-21 21:40:03
NVM. I didn't!
/wipes sweat from forehead I was just busy. :x Now it's time for a game of LoL! /flies off
Fairy.Spence
Server: Fairy
Game: FFXI
Posts: 23779
By Fairy.Spence 2012-02-21 21:42:58
I miss LoL :(
Caitsith.Zahrah
Server: Caitsith
Game: FFXI
By Caitsith.Zahrah 2012-02-21 21:43:47
/comfort
This is a thread that I found on another website I post at. It can be really really interesting. I thought it deserved a place here.
Post your random thoughts for the day here, or anything else that intrigues you.
For starters, is it possible to give constructive critism to someone who doesn't have a neck? I totally just walked by a girl who didn't. Someone isn't getting a necklace for Valentines day!
And who decided black and white can't be colors? I want to say a racist. I really do.
Inb4thisthreadgetsreallywtf
|
|