C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 11th, 2015, 10:34 AM
Murcrow Murcrow is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2015
Posts: 2 Murcrow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 39 sec
Reputation Power: 0
General - My timer isn't working, need help [Sorry for Swedish]

#include <iostream>
#include <thread>
#include <chrono>
using namespace std;

int funkConvert(int konstistens) { // Funktion som räknar om önskad konsistens till rätt koktid.

int tid; // Skapar variabeln tid.
if (konstistens == 1) {
tid = 2;
}
else if (konstistens == 2) {
tid = 4;
}
else if (konstistens == 3) {
tid = 6;
}
else if (konstistens == 4) {
tid = 8;
}
else{
tid = 10;
} // Använder önskad konsistens och omvandlar till tid.
return tid; // Returnerar tid.
}

int main () {

int min, sek, sekleft, mins, ägg, anrop1;
cout << "Välkommen till äggklockan!" << endl << "Notera att tiden kan variera beroende på storleken av ägget." << endl << "Hur vill du ha ditt ägg?" << endl << endl << "1. Löst" << endl << "2. Ganska löst" << endl << "3. Mellan" << endl << "4. Ganska hårt" << endl << "5. Hårt" << endl << endl; // Välkomnar användaren och ger de olika kok-alternativen.
cin >> ägg; // Låter användaren skriva in önskad konsistens.

anrop1 = funkConvert(ägg); // Anropar omvandlar-funktionen.
cout << endl << "Ditt ägg ska koka i " << anrop1 << " minuter." << endl << endl; // Skriver ut hur länge ägget ska koka.

anrop1 = mins;
sek = mins*60;
while (sek > 0) {
min = sek/60;
sekleft = sek%60;
if (min > 0) {
cout << min << " minuter och ";
}
cout << sekleft << "sekunder.";
sek = sek-1;
this_thread::sleep_for(chrono::seconds(1));
}
cout << "Noll! Ditt ägg är nu klart!" << endl << "Lägg ägget i kallt vatten så behåller det rätt konsistens." << endl << endl;
return 0;
}

Reply With Quote
  #2  
Old May 14th, 2015, 02:09 AM
Thinias Thinias is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 78 Thinias User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 h 58 m 48 sec
Reputation Power: 8
To be honest, it feels a lot like you copy-pasted this (fairly simple) code from somewhere, and now you want someone else to figure it out for you. At least convert it to English to ask on an English-speaking forum . This perception of a complete lack of effort on your part makes me feel heavily un-inclined towards assisting you.

Reply With Quote
  #3  
Old May 14th, 2015, 04:20 AM
Murcrow Murcrow is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2015
Posts: 2 Murcrow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 39 sec
Reputation Power: 0
It's a shame that you think I havn't written this myself and that the code is ugly... On the other hand, I don't need your help since I fixed it myself. Sorry for wasting your "valuable" time.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - My timer isn't working, need help [Sorry for Swedish]


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap