| View previous topic :: View next topic |
| Author |
Message |
paupav Master Cheater
Reputation: 13
Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
|
Posted: Thu Aug 09, 2012 6:17 am Post subject: what is wrong here? |
|
|
it calculate wrong,
| Code: |
#include "stdafx.h"
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ()
{
system("color 05");
int godinaRodjenja, mjesecRodjenja, danRodjenja;
int danasnjiDan, danasnjiMjesec, danasnjaGodina;
int razlikaDana, razlikaMjeseci, razlikaGodina;
string myString;
string drzava;
string danasnjiDatum;
cout << "Are you from west or from east? \n(answer with east or west or write help for help) ";
getline(cin, drzava);
if(drzava == "help")
{
cout << "\nIf you write west date will be formatted YYYY/MM/DD\nand if you write east date will be formatted DD/MM/YYYY";
cout << "\n\nAre you from west or from east? (answer only with west or east) ";
getline(cin, drzava);
}
else if(drzava == "east")
{
//danasnji dan
cout << "Enter witch day is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >>danasnjiDan;
//danasnji mjesec
cout << "Enter witch month is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >> danasnjiMjesec;
//danasnja godina
cout << "Enter witch year is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >> danasnjaGodina;
//danasnji datum
cout << "So today is: " << danasnjiDan <<"." << danasnjiMjesec << "." << danasnjaGodina;
cout << "\nEnter day of birth! (only number) ";
getline(cin, myString);
stringstream(myString) >> danRodjenja;
cout << "\nEnter month of birth! (only number)";
getline(cin, myString);
stringstream(myString) >> mjesecRodjenja;
cout << "\nEnter year of birth! (only number)";
getline(cin, myString);
stringstream(myString) >> godinaRodjenja;
//cout << "\nYou have been born " << dan; //provjera
}
else if(drzava == "west")
{
//danasnja godina
cout << "Enter witch year is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >> danasnjaGodina;
//danasnji mjesec
cout << "Enter witch month is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >> danasnjiMjesec;
//danasnji dan
cout << "Enter witch day is today! " ;
getline(cin, danasnjiDatum);
stringstream(danasnjiDatum) >> danasnjiDan;
//danasnji datum
cout << "So today is: " << danasnjiMjesec <<"." << danasnjiDan << "." << danasnjaGodina;
//unesti godinu rodjenja
cout << "\nEnter year of birth! (only number)";
getline(cin, myString);
stringstream(myString) >> godinaRodjenja;
//unesti mjesec rodjenja
cout << "\nEnter month of birth! (only number)";
getline(cin, myString);
stringstream(myString) >> mjesecRodjenja;
//unesti dan rodjenja
cout << "Enter day of birth! (only number) ";
getline(cin, myString);
stringstream(myString) >> danRodjenja;
}
else
{
cout << "\nWront input!\nPlease restart application!";
}
//cout << "\nYou have been born " << danRodjenja <<"." << mjesecRodjenja << "." <<godinaRodjenja; //verification if everything is fine
// ------------------------ checked
//razlika dani
if (danRodjenja << danasnjiDan)
{
danasnjiDan + 30;
danasnjiMjesec--;
razlikaDana=danasnjiDan-danRodjenja;
}
else if (danRodjenja >= danasnjiDan)
{
razlikaDana=danasnjiDan-danRodjenja;
}
else
{
cout << "\nNo imput, please restart application";
}
//razlika mjeseci
if (mjesecRodjenja << danasnjiMjesec) // 9 << 8
{
danasnjaGodina--;
danasnjiMjesec + 12;
razlikaMjeseci=mjesecRodjenja-danasnjiMjesec;
}
else if (mjesecRodjenja >= danasnjiMjesec)
{
razlikaMjeseci=danasnjiMjesec-mjesecRodjenja;
}
else
{
cout << "\n No imput, please restart application";
}
//razlika godine
razlikaGodina=danasnjaGodina-godinaRodjenja;
cout <<"You live: " << razlikaDana <<" days, " << razlikaMjeseci <<" months, " << razlikaGodina << " years.";
cout << "\n";
system("pause");
return 0;
}
|
|
|
| Back to top |
|
 |
Fafaffy Cheater
Reputation: 65
Joined: 12 Dec 2007 Posts: 28
|
Posted: Thu Aug 09, 2012 11:36 am Post subject: |
|
|
I'm gonna say what I say to most retards:
How does it fuck up?
What portion of the code do you think is fucked up?
Screenshot of said error?
_________________
| Brillia wrote: | | I FUCKING FUCK SEX |
|
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6549 Location: Texas
|
Posted: Thu Aug 09, 2012 11:38 am Post subject: |
|
|
I suggest using an editor that can help with these things.
_________________
|
|
| Back to top |
|
 |
Maes Advanced Cheater
Reputation: 10
Joined: 09 Apr 2009 Posts: 50
|
Posted: Thu Aug 09, 2012 11:39 am Post subject: |
|
|
| Up2Admin wrote: | | I suggest using an editor that can help with these things. |
|
|
| Back to top |
|
 |
shitposter Newbie cheater
Reputation: 5
Joined: 12 Nov 2008 Posts: 15
|
Posted: Thu Aug 09, 2012 11:55 am Post subject: |
|
|
| This code is unreadable.
|
|
| Back to top |
|
 |
Up2Admin I'm a spammer
Reputation: 126
Joined: 17 Oct 2007 Posts: 6549 Location: Texas
|
Posted: Thu Aug 09, 2012 12:36 pm Post subject: |
|
|
| xTremist wrote: | | This code is unreadable. | Because the variables are in some stupid ass-backwards language, like Croatian or whatever.
_________________
|
|
| Back to top |
|
 |
elpacco Grandmaster Cheater Supreme
Reputation: 30
Joined: 16 Oct 2007 Posts: 1258
|
Posted: Thu Aug 09, 2012 1:10 pm Post subject: |
|
|
which*
_________________
| [AM]Misery wrote: |
| FangBanger wrote: | | What is the best way for a lv19 Soldier to solo Sledge on Borderlands? | Shoot him. |
|
|
| Back to top |
|
 |
paupav Master Cheater
Reputation: 13
Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
|
Posted: Thu Aug 09, 2012 3:07 pm Post subject: |
|
|
| nvm i found it todayDay + 30 , it should be todayDay+=30
|
|
| Back to top |
|
 |
Sephiron Master Cheater
Reputation: 34
Joined: 23 Aug 2008 Posts: 292 Location: JAPAN circa 1653, fucking some seagulls
|
Posted: Thu Aug 09, 2012 3:10 pm Post subject: |
|
|
The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make.
_________________
| Nirojan wrote: | | picked up 1,.5 g and them budduty picled up quarter o today we blase all of |
 |
|
| Back to top |
|
 |
paupav Master Cheater
Reputation: 13
Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
|
Posted: Thu Aug 09, 2012 3:12 pm Post subject: |
|
|
| Sephiron wrote: | The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make. |
what you mean? this all what im learning isnt going to be useful in making games?
|
|
| Back to top |
|
 |
Sephiron Master Cheater
Reputation: 34
Joined: 23 Aug 2008 Posts: 292 Location: JAPAN circa 1653, fucking some seagulls
|
Posted: Thu Aug 09, 2012 3:15 pm Post subject: |
|
|
| paupav wrote: | | Sephiron wrote: | The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make. |
what you mean? this all what im learning isnt going to be useful in making games? |
It's useful for teaching you how to make a game loop. What you did pretty much is make a fancy calculator. Keep learning. Find out how to call functions for different actions, and learn how to update things. Idunno. Like I said, I never got to graphics handling since something about it confuses me. I'm probably not the best example for these things.
_________________
| Nirojan wrote: | | picked up 1,.5 g and them budduty picled up quarter o today we blase all of |
 |
|
| Back to top |
|
 |
Evil_Intentions Expert Cheater
Reputation: 65
Joined: 07 Jan 2010 Posts: 214
|
Posted: Thu Aug 09, 2012 3:35 pm Post subject: |
|
|
| Sephiron wrote: | The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make. |
I had liked using c++ to do some project euler problems back when I first started.
|
|
| Back to top |
|
 |
Sephiron Master Cheater
Reputation: 34
Joined: 23 Aug 2008 Posts: 292 Location: JAPAN circa 1653, fucking some seagulls
|
Posted: Thu Aug 09, 2012 3:41 pm Post subject: |
|
|
| Evil_Intentions wrote: | | Sephiron wrote: | The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make. |
I had liked using c++ to do some project euler problems back when I first started. |
That's always fun.
By the way OP, I tested your program and the math's a bit off.
for one, I tried it on my mom. She was born in September, yet it said she was 46 years and 2 months old (Implying that her birthday was 2 months ago). The year was correct, however.
_________________
| Nirojan wrote: | | picked up 1,.5 g and them budduty picled up quarter o today we blase all of |
 |
|
| Back to top |
|
 |
paupav Master Cheater
Reputation: 13
Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
|
Posted: Thu Aug 09, 2012 5:05 pm Post subject: |
|
|
| Sephiron wrote: | | Evil_Intentions wrote: | | Sephiron wrote: | The thing I hate about console c++ is that there's literally no practical application for it unless you know how to handle graphics; something I fucking don't know how to do.
I once made a pokemon style battle rpg with random monsters and items and an inventory system and everything, but it was all text based. I might actually try it again. Was pretty fun to make. |
I had liked using c++ to do some project euler problems back when I first started. |
That's always fun.
By the way OP, I tested your program and the math's a bit off.
for one, I tried it on my mom. She was born in September, yet it said she was 46 years and 2 months old (Implying that her birthday was 2 months ago). The year was correct, however. |
idk il see tomorrow, it work for me ... but this was only practice anyway ....
EDIT: i thought this is some other thread. i solved that problem
http://www.mediafire.com/?ntci4ry47ewndfr
|
|
| Back to top |
|
 |
|