For a first time tourist, depending on how much time you have for your visit, I would recommend about 3 days for Shanghai and at least 4 or 5 days for Beijing. Places to see? In Shanghai, the Pearl Tower and the history museum at its basement, the Shanghai Museum, Nanjing St (do not go with any girls or young people here who want to practise their English in a tea shop or any who say they are art students. Both are notorious scams). A trip along the river is good and the Bund at night is a must.
There is a lot to see in and around Beijing, more so I think than Shanghai. You must take time to see the Great Wall (Badaling or, even better I've heard, is the Mutianyu site). The there is Tiananmen Square and opposite that is the Forbidden City. There's the temple of Heaven, the Summer Palace and the Lama Temple. Don't forget to try to see the Olympic site at night time when it is all lit up.
I travelled mostly by the underground rail systems in both cities and both are excellent. Shanghai is slightly more expensive (4 RMB per trip I think) but Beijing is only 2 yuan per trip. I bought a travel card for 20 and put and extra 20 on it to make travelling on the train really convenient, sort of like Hong Kong's Octopus card. Just swipe on entry and swipe on exit and it calculates the cost and deducts it automatically for you.
I hope this helps. Have a good time!! Oh, and don't forget to take a trip on the Maglev train from Shanghai Pudong airport to Longyang rail station. Cost is about 50RMB (one way) but it reaches speeds of over 400km per hour. It's fantastic! From Longyang you can either catch a taxi or transfer to the Shanghai metro. about 6 years ago
I would add that you factor in time to account for then horrendous traffic in Beijing (haven't been to Shanghai). On a recent trip, we found that we didn't spend enough time at the key sites due to our later than planned on arrival time due to the traffic. Once there, though, you will be impressed and fascinated. Enjoy! about 6 years ago
2-3 days for Shanghai. At least 3 days for Beijing and 5 or 6 if you can spare. Depends upon your interests and whether or not you plan on visiting nearby destinations (such as water-twons from Shanghai) but then there is always something else for those with more time about 6 years ago