Why does this code give a compilation error? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why does this code give a compilation error?

#include <iostream> #include <string> using namespace std; int main() { cout<<"Welcome to Z# Console Interpreter Alpha version 1.0. Type <Zsharp.Libraries.Functions;> to get a list with all available Z# commands and functions."<<endl; cout<<"-->"; string s; getline(cin,s); int syntax = 0; //Print HelloWorld if(s=="AppFrame.Out.Hello;"){ cout<<"Hello World!"<<endl; cout<<"-->"; } //Sum two numbers int sumx; int sumy; int sum; if(s=="Arithmetic(x+y);"){ cin >> sumx; cin >> sumy; sum = sumx+sumy; cout<< sum <<endl; cout<<"-->"; } //Multiply two numbers int multipx; int multipy; int multip; if(s=="Arithmetic(x*y);"){ cin >> multipx; cin >> multipy; multip = multipx * multipy; cout<< multip <<endl; cout<<"-->"; } //Divide two numbers int dividx; int dividy; int divid; if(s=="Arithmetic(x/y);"){ cin >> dividx; cin >> dividy; divid = dividx / dividy; cout<< divid <<endl; cout<<"-->"; } //Subtract two numbers int subx; int suby; int sub; if(s=="Arithmetic(x-y);"){ cin >> subx; cin >> suby; sub = subx - suby; cout<< sub <<endl; cout<<"-->"; } //Prints a string to the screen string txt; if(s=="AppFrame.Out.Print;"){ getline(cin,txt); cout << txt; } //create variables if(s=="System.Var.New;"){ int newvar; cout << "Give this variable a value: "; cin >> newvar; } //Greets the user and asks for its name string username; if(s=="AppFrame.In.Greet"){ cout << "Please enter your name: "; getline(cin,username); cout << "Hello, "; cout << username; } //Gets a list with all the available R# commands if(s=="Zsharp.Libraries.Functions;"){ cout << "Arithmetic(x+y);\n"; cout << "Arithmetic(x*y);\n"; cout << "Ari

1st May 2017, 5:53 PM
André Pereira
André Pereira - avatar
8 Antworten
+ 2
What error do you get, and on what line/part? There's too much here to sift through if it tells you in the compilation error.
1st May 2017, 6:12 PM
Keto Z
Keto Z - avatar
+ 1
i see one thing a string without ' '
1st May 2017, 6:23 PM
Jasper ten Hove
Jasper ten Hove - avatar
0
The Sololearn's compiler just tells me "compiler error", but it doesn't give me any error code.
1st May 2017, 6:17 PM
André Pereira
André Pereira - avatar
0
Where?
1st May 2017, 6:42 PM
André Pereira
André Pereira - avatar
0
under the first cout<<"-->";
1st May 2017, 6:44 PM
Jasper ten Hove
Jasper ten Hove - avatar
0
Right after int main()?
1st May 2017, 6:47 PM
André Pereira
André Pereira - avatar
0
yup
1st May 2017, 6:47 PM
Jasper ten Hove
Jasper ten Hove - avatar
0
it still contains errors. But I don't know where
7th May 2017, 12:26 AM
André Pereira
André Pereira - avatar