I'm trying to write a code for class and after compiling the first half with g++, just make sure it'd work so far, I get all these errors. After looking them all up I don't understand why i'm getting these errors or how to fix them. If anyone could please help, this is my first attempt at C++ coding

#include <iostream>
using namespace std;

int main()
{
	double *num1ptr = new double;
	double *num2ptr = new double;
	char *oprptr = new char;
	double *solptr = new double;

	cout << "This program will add, subtract, multiply, or
divide two numbers inputted by the user." << endl;

	cout << "Please enter first number: ";
	cin >> *num1ptr;
	cout << "Please enter second number: ";
	cin >> *num2ptr;
	cout << "Enter the operation you would like to perform (to add use
'+', to subtract use '-', to multiply use'*', to divide use '/'): ";
	cin >> *oprptr;
	

}

these are the errors I get:
In function `int main()':
error: missing terminating " character
error: `divide' was not declared in this scope
error: expected `;' before "two"
error: missing terminating " character
error: missing terminating " character
error: `to' was not declared in this scope
error: expected `;' before "subtract"
error: missing terminating " character

cout<<"String";

The "String" should start and end on same line in the editor or you can extend it like ..

cout<<"Str"
<<"ing";

You have carriage returns in the middle of your string literals, you can't do that. If you want the output to wrap to the next line, you need to insert a newline character '\n'.

Okay thanks! i didn't realize that would be an issue just because the text editor just put it on a new line because it was too long! Thanks so much!

You can split a string literal to multiple lines like so ..

// A single string literal
cout << "This program will "
        "add, subtract, multiply, or "
        "divide two numbers inputted "
        "by the user."
     << endl;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.