View Single Post
Old 12-06-2004, 01:03 PM   #1 (permalink)
Crow T. Robot
Registered User
 
Join Date: Nov 2004
Posts: 14
Crow T. Robot is on a distinguished road
Basic C++ functionality

I'm familiar with Java but have just started C++. I have a very simple program but need to work out mostly problems such as syntax, proper declarations, etc. The program simply asks the user for their name, a lucky number, and then print them out, but I don't think I have variables initialized or read in properly, and probably some other problems of that nature. I just started using a C++ compiler and don't know how to get it to actually compile and run the program, so here it is.

Code:
#include <iostream>

int main() 
    {
    char name;
    int num;
    
    cout << "Enter your name/n";
    cin >> name;
    
    cout << "Enter your favorite lucky number/n";
    cin >> num;
    
    cout << "Hello " + name + ", I like the number " + num + "also!"
    }
Crow T. Robot is offline   Reply With Quote