Problem z kompilacją - co robię nie tak?
Ostatnio zmodyfikowano 2016-12-16 02:26
BlackTrue Temat założony przez niniejszego użytkownika |
Problem z kompilacją - co robię nie tak? » 2016-12-16 02:26:00 Piszę podczas nauki prosty program ,który pobiera od nas 2 liczby ,sprawdza czy są całkowite (jeżeli nie ,to prosi o ponowne wpisanie liczby) i wykonuje na nich podstawowe działania.
jednak dostaje następujące błędy :
-------------- Build: Debug in 11 ---------------
Compiling: main.cpp D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp: In function 'int main()': D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:19: warning: statement has no effect D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:25: warning: statement has no effect D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:33: warning: statement has no effect D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:39: warning: statement has no effect D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp: At global scope: D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:48: error: expected constructor, destructor, or type conversion before '<<' token D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:55: error: expected unqualified-id before 'return' D:\===TRYZ===\Programowanie\Projekty C ++ - Nauka\11\11\main.cpp:56: error: expected declaration before '}' token Process terminated with status 1 (0 minutes, 0 seconds) 3 errors, 4 warnings
Oto mój kod :
#include <iostream>
using namespace std;
int a; int b; int c; int d;
int main() {
while(c<1) { cout << "podaj liczbe calkowita 'a' :"; cin >> a; c=a; c/c;
if(c<1) cout << "podales niepoprawne dane ,wprowadz liczbe ponownie :"; cin >> a; c=a; c/c; }
while(d<1) { cout << "podaj liczbe calkowita 'b' :"; cin >> b; b=d; d/d;
if(d<1) cout << "podales niepoprawne dane ,wprowadz liczbe ponownie :"; cin >> b; b=d; d/d; }
}
cout << endl << "a+b=" << a+b << endl << "a-b=" << a-b << endl << "a*b=" << a*b << endl << "a/b=" << a/b << endl << "a%b=" << a%b;
return 0; }
|
|
« 1 » |