Anonymní profil Jacobs – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil Jacobs – Programujte.comAnonymní profil Jacobs – Programujte.com

 

Příspěvky odeslané z IP adresy 92.52.5.–

C / C++ › A function definition is not…
27. 2. 2014   #187764

#8 KIIV
Dakujem - bola chyba v pocte { a } v prvej funkcii. 

C / C++ › A function definition is not…
27. 2. 2014   #187762

Pred funkciou int main() mam uz len jednu funkciu + globalne premenne

#include <iostream>
#include <fstream>
#include <string>
#include <stdio.h>
#include <ctime>
#include <cstdlib>

using namespace std;

void Intro();
void FirstChoice();
void ChangeInfo();
void StockMarketList();
int production();


string FullName;
double Age = 0;
string com;
string building;
int week = 1;
int money = 10000;
int buildings = 1;
int productions = 0;
int AmountOfCommodity = 0;
int AmountOfSelling = 0;
int gain = 0;
int value[7] = {rand()%7,rand()%7,rand()%10,rand()%20,rand()%30,rand()%50,rand()%20};
int x = 0;


string varx;

void BasicGameCycle ()
{

    int weeek = 1;

    while(money < 350000)
    {

    AmountOfCommodity + production();

    cout << "Week " << week << endl;
    cout << "Your production is " << production() << " KG per week. Current balance - " << AmountOfCommodity << endl;
    cout << "---------------------------- \n";
    if(weeek == 4)
    {
        StockMarketList();
        weeek = 0;
    }

    week++;
    weeek++;

    cout << "Invest - INV ---- Buy a " << building << " - BUY ---- Sell - SELL \n";
    cin >> varx;

    if(varx == "BUY")
    {
        buildings++;
    }





}
C / C++ › A function definition is not…
27. 2. 2014   #187757

Nic ved vidis v tom zdrojovom kode co som tam dal

C / C++ › A function definition is not…
27. 2. 2014   #187753

Ospravedlnujem sa.

Chyby hlasi vzdy na zaciatku kazdej funkcie na riadku kde je {

int main()

{   --- chyba

/to do

}

C / C++ › A function definition is not…
27. 2. 2014   #187745

Zdravím. Toto sú časti kódu v ktorom mi to vypisuje error "a function definition is not allowed here before { token". Neviem prečo.

  

int main()
{
    srand(time(0));

    Intro();
    FirstChoice();
    ChangeInfo();
    cout << "So let's start. Here is the first Stock Market List. Your starting capital is 10 000 dollars. Your goal is 300 000 dollars. It's easy ! \n";
    cout << "You will move in weeks. Every 4 weeks you will get list of world's stock market status. Good luck, " << FullName << endl;

    StockMarketList();
    cout << "Here is your first " << building << ". In the time, you will buy more " << building << "s." << endl;

    BasicGameCycle();

    return 0;
}
void Intro()
{
    double version = 0.1;
    cout << "version " << version << endl << endl;

    cout << "Welcome to Stock Market Simulator (SMS). Please enjoy. \n" << endl;

    cout << "What is your name ? \n";
    getline(cin,FullName);

    cout << "And your age is ? \n";
    cin >> Age;

}
void FirstChoice()
{

    cout << "Welcome to SMS " << FullName << endl;
    cout << "First you have to choose commodity you wanna trade with. Minerals = easy ----- Fruits = hard \n";
    cout << "Minerals : Iron, Copper, Gold, Tin \n";
    cout << "Fruits : Apples, Bananas, Lemons \n";
    cin >> com;

    while(com != "Iron" && com != "Copper" && com != "Gold" && com != "Tin" && com != "Apples" && com != "Bananas" && com != "Lemons")
    {
        cout << "Please, choose from the list. \n";
        cin >> com;
    }


    cout << "Hmm " << com << " is great choice ! \n";

    if (com == "Apples" || com == "Bananas" || com == "Lemons")
    {
        building = "plantage";
    }else{
        building = "mine";
    }


}


Išlo to v pohode kúsok kódu som zmenil - ani nie v týchto funkciách a zrazu toto...

Kukal som aj na ostatne fora a dozvedel som sa ze sa nema definovat funkcia v inej funkcii.. No nic take tu nie je a stale ten error vypisuje.

C / C++ › [C++] Tutorial: Jak se nauči…
26. 2. 2014   #187684

Hmm, ak by sa dalo tak prosim opravit tie linky na uloz.to  -  su nefunkcne :)

C / C++ › Hledám programátorský tým
10. 12. 2013   #185072

Ja iba ked tak sa nieco priucit, s moblinimi appkami som nerobil takze by to bolo nieco nove :)

C / C++ › Zastavenie programu v nesprá…
10. 12. 2013   #185051

Dakujem, funguje to.

Blender › Hledá se grafik v blenderu n…
9. 12. 2013   #185028

Nikto ta do toho nenuti.. Inu, je to super prilezitost uplatnit sa (aspon pre zaciatok) takze ja sa ucim v Blednri, keby som vedel viac ozval by som sa ti, no prezatial ti drzim palce :)

C / C++ › Zastavenie programu v nesprá…
9. 12. 2013   #185027

No ja som spominal ze sa to ucim takze neviem presne ako to spravit, ak by to neobtažovalo tak povedali by ste mi tuto poslednu vec ? :)

C / C++ › Zastavenie programu v nesprá…
9. 12. 2013   #185009

A teda ako to mam vyriesit ??

C / C++ › Zastavenie programu v nesprá…
9. 12. 2013   #185006

Hmm, skusil som to dat ako

    cout << "What is your job ? \n";
    cin >> job;

namiesto getline(cin, job) a toto funguje ale ked je to nieco zlozene z dvoch slov tak je to v keli, tak teda nevie niekto preco getline v tomto pripade nefunguje a v prvom ano ? :/

Jacobs
C / C++ › Zastavenie programu v nesprá…
9. 12. 2013   #185002

Ahoj, som začiatočník, učím sa programovať v c++ a mam menší problém : 

#include <iostream>
#include <string>


using namespace std;

int main()
{
    string name;
    int age = 0;
    string job;

    cout << "Type in your name please \n";
    getline(cin, name);

    cout << "Type in your age \n";
    cin >> age;

    cout << "What is your job ? \n";
    getline(cin, job);

    cout << "\n";
    cout << "PROFILE: \n";
    cout << "------------- \n";
    cout << "Name: " << name << endl;
    cout << "Age: " << age << endl;
    cout << "Job:" << job << endl;
    cout << "------------- \n";

    return 0;
}

Normálne spustím program v konzole a všetko ide až po "What is your job" vypíše to len otázku a potom hneď profil, nedá to priestor na vstup.. A viem že je to primitívne ale naozaj neviem prečo to tak je.. 

Jacobs
C / C++ › Hledá se programátor
9. 12. 2013   #184993

Hod sem zadanie

 

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý