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
Offline
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
Offline
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: 1030
Currently Online:
Guest(s) 189
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 —