Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6787525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:22:36+00:00 2026-05-26T17:22:36+00:00

When i try to output the string it doesnt output the text after the

  • 0

When i try to output the string it doesnt output the text after the space. It should ask for student name and then output it when asked. This is C++. I have no more info to give but the site wont let me post it so this sentence is here.

/***************************************************/
/* Author:     Sam LaManna                         */
/* Course:     CSC 135 Lisa Frye                   */
/* Assignment: Program 4 Grade Average             */
/* Due Date:   10/10/11                            */
/* Filename:   program4.cpp                        */
/* Purpose:    Write a program that will process   */
/*             students are their grades. It will  */
/*             also read in 10 test scores and     */
/*             compute their average               */
/***************************************************/

#include <iostream>     //Basic input/output
#include <iomanip>      //Manipulators

using namespace std;

string studname ();     //Function declaration for getting students name

int main()
{
  string studentname = "a";     //Define Var for storing students name

  studentname = studname ();    //Store value from function for students name

  cout << "\n" << "Student name is: " <<studentname << "\n" << "\n";     //String output test

  return 0;
}

/***************************************************/
/* Name: studname                                  */
/* Description: Get student's first and last name  */
/* Paramerters: N/A                                */
/* Return Value: studname                          */
/***************************************************/

string studname()
{
  string studname = "default";


  cout << "Please enther the students name: ";
  cin >> studname;

  return studname;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:22:37+00:00Added an answer on May 26, 2026 at 5:22 pm

    you can use getline so like this

    string abc;
    cout<<"Enter Name";
    getline(cin,abc);
    cout<<abc;
    

    Getline

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an output that is basically a paragraph and when I try to
I have XML document that I parse with jDOM and then try to take
How do I match the URL address in this string, I have other code
I need to read the output from ffmpeg in order to even try the
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
try { ... } catch (SQLException sqle) { String theError = (sqle).getSQLState(); ... }
I want to output two different views (one as a string that will be
I have a Runnable that reads Console output from an externally called exe (see
I have this piece of code that basically checks if one or more files
how use Runtime.getRuntime().exec()? I try: try { String[] callAndArgs = {path\\program.exe,arg1,arg2,arg3} System.out.println(before); Process p

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.