The forums are currently locked and only available for read only access
Tovedal
Kommer du hit ofta?
Medlem
Forum Posts: 282
Member Since:
June 29, 2004
June 29, 2004
![sp_UserOfflineSmall](https://nordichardware.se/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
jag har problem med följande kod:
#include <iostream>
#include <iomanip>
using namespace std;
main()
{
int dagar_tot, dagar=0;
double lon=0, sam_lon=0.0;
const int manad=30;
cout << "Om hur många dagar blir du miljonär???" << endl
<< "Knappa in din månadslön: "; cin >> lon;
while (sam_lon < 1000000)
{
sam_lon + lon;
dagar++;
}
dagar_tot = dagar * manad;
cout << "Du blir miljonär om " << dagar_tot << " dagar då du har exakt "
<< sam_lon << " kronor.";
system("pause");
}
man "hinner" skriva in sin lön men sedan så vägrar den gå in i loopen... 🙁
Chewie
Kommer du hit ofta?
Medlem
Forum Posts: 1516
Member Since:
September 13, 2001
September 13, 2001
![sp_UserOfflineSmall](https://nordichardware.se/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Läs din output från kompillatorn.
Detta är output från "gcc version 3.2.3".
~/c++/tmp $ g++ -Wall test.cpp -o a
test.cpp:5: warning: ISO C++ forbids declaration of `main' with no type
test.cpp: In function `int main()':
test.cpp:13: warning: statement with no effect
Rad 5: måste vara
int main()
Rad 13: Ja där ser du varför det inte fungerar.
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 694
Currently Online:
Guest(s) 51
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Andreas Galistel: 16287
Jonas Klar: 15897
ilg@dd: 10810
Nyhet: 10607
Mind: 10550
Ctrl: 10355
Gueno: 9881
Guest: 9344
Snorch: 8881
Callister: 8468
Newest Members:
PetrbonFU PetrbonFU
Karine Bembry
Dolores Mcdaniels
Anibal McLeish
Francisca Alt
Alfie Everhart
Lester Huitt
Orlando Jorgensen
Mikki Lundgren
Dakota Kozlowski
Forum Stats:
Groups: 11
Forums: 59
Topics: 146630
Posts: 1300967
Member Stats:
Guest Posters: 2
Members: 79425
Moderators: 0
Admins: 11
Administrators: nordicadmin, Henrik Berntsson, Anton Karmehed, Carl Holmberg, Joel Oscarsson, Mikael Linnér, Mikael Schwartz, Andreas Paulsson, Nickebjrk, Mattias Pettersson, EmxL
© Simple:Press —
![sp_Information](https://nordichardware.se/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_Information.png)