Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

problem z kompilacją - "kreator wizytowek" - HELP ME!

Ostatnio zmodyfikowano 2008-04-11 15:20
Autor Wiadomość
ppp
Temat założony przez niniejszego użytkownika
problem z kompilacją - "kreator wizytowek" - HELP ME!
» 2008-04-08 12:07:40
mam problem z kompilacją mojego programu:

C/C++
#include <iostream>
#include <conio.h>
#include <fstream>
#include "console.ddt"
using namespace ddt::console;
using namespace std;
int main()
{
    std::fstream plik;
    char timie[ 15 ];
    char tnazwisko[ 15 ];
    char ttelefon[ 15 ];
    char potwierdzenie[ 1 ];
    plik.open( "data.txt", ios::in );
    cout << "...:::KREATOR WIZYTOWEK:::..." << endl << endl;
    cout << "podaj imie: ";
    getline( cin, timie );
    cout << "podaj nazwisko: ";
    getline( cin, tnazwisko );
    cout << "Podaj telefon: ";
    getline( cin, ttelefon );
    cout << "Potwierdzić? [T]/[N]" << endl;
    switch( potwierdzenie )
    {
    case 116:
        clrscr();
        cout << "ZAKONCZONO!" < endl;
        cout << "nacisnij dowolny klwaisz aby zobaczyc wizytowke" << endl;
        getch();
        clrscr();
        cout << "**********************" << endl;
        cout << "Imie: " << timie << endl;
        cout << "Nazwisko: " << tnazwisko << endl;
        cout << "Telefon: " << ttelefon << endl;
        cout << "**********************" << endl << endl << endl;
        cout << "Zapisać? [T]/[N]" << endl << endl;
    case 116:
        clrscr();
        cout << "**********************" << endl;
        cout << "Imie: " << timie << endl;
        cout << "Nazwisko: " << tnazwisko << endl;
        cout << "Telefon: " << ttelefon << endl;
        cout << "**********************" << endl;
        flush();
        clrscr();
        cout << "utworzono plik!" << endl << endl;
        cout << "naciscnik dowolny klawisz..." << endl;
        getch();
        plik.close();
        return( 0 );
    case 110:
        cout << "nie zapisano!" << endl;
        cout << "nacisnij dowolny klawisz" << endl;
        getch();
        plik.close();
        return( 0 );
        default:
        cout << "Niema takiej opcjii" << endl << endl << endl;
        plik.close();
        cout << "nacisnij dowolny klawisz..." << endl;
        getch();
        return( 0 );
    case 110:
        cout << "Nie potwierdzono!" << endl;
        cout << "nacisnij dowolny klawisz..." << endl;
        getch();
        plik.close();
        return( 0 );
        default:
        cout << "Niema takiej opcjii" << endl << endl << endl;
        plik.close();
    }
    getch();
    return( 0 );
}
 
POMOCY
P-442
DejaVu
» 2008-04-08 12:45:11
Popraw fragment programu:
C/C++
std::string timie;
std::string tnazwisko;
std::string ttelefon;
char potwierdzenie;
plik.open( "data.txt", ios::in );
cout << "...:::KREATOR WIZYTOWEK:::..." << endl << endl;
cout << "podaj imie: ";
getline( cin, timie );
cout << "podaj nazwisko: ";
getline( cin, tnazwisko );
cout << "Podaj telefon: ";
getline( cin, ttelefon );
cout << "Potwierdzić? [T]/[N]" << endl;
Dodatkowo poczytaj o switch, case, ponieważ źle z niej korzystasz (źle -> np. 2 razy ta sama wartość w case).

/edit: Lekcja: http://ddt.pl/kursy/?LessonId=8
P-444
ppp
Temat założony przez niniejszego użytkownika
rozwiazany problem
» 2008-04-11 15:20:19
rozwiązałem problem :) i program dał się skompilować :D:)
P-480
« 1 »
  Strona 1 z 1